mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Reset rule order on index. #3376
This commit is contained in:
parent
ef9714b7e0
commit
4ebb6de520
@ -91,6 +91,7 @@ class IndexController extends Controller
|
|||||||
$user = auth()->user();
|
$user = auth()->user();
|
||||||
$this->createDefaultRuleGroup();
|
$this->createDefaultRuleGroup();
|
||||||
$this->createDefaultRule();
|
$this->createDefaultRule();
|
||||||
|
$this->ruleGroupRepos->resetRuleGroupOrder();
|
||||||
$ruleGroups = $this->ruleGroupRepos->getRuleGroupsWithRules($user);
|
$ruleGroups = $this->ruleGroupRepos->getRuleGroupsWithRules($user);
|
||||||
|
|
||||||
return view('rules.index', compact('ruleGroups'));
|
return view('rules.index', compact('ruleGroups'));
|
||||||
|
@ -56,7 +56,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param RuleGroup $ruleGroup
|
* @param RuleGroup $ruleGroup
|
||||||
* @param RuleGroup|null $moveTo
|
* @param RuleGroup|null $moveTo
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
@ -98,6 +98,10 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
|||||||
foreach ($set as $entry) {
|
foreach ($set as $entry) {
|
||||||
$entry->order = $count;
|
$entry->order = $count;
|
||||||
$entry->save();
|
$entry->save();
|
||||||
|
|
||||||
|
// also update rules in group.
|
||||||
|
$this->resetRulesInGroupOrder($entry);
|
||||||
|
|
||||||
++$count;
|
++$count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +118,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
|||||||
$ruleGroup->rules()->whereNotNull('deleted_at')->update(['order' => 0]);
|
$ruleGroup->rules()->whereNotNull('deleted_at')->update(['order' => 0]);
|
||||||
|
|
||||||
$set = $ruleGroup->rules()
|
$set = $ruleGroup->rules()
|
||||||
|
->orderBy('active','DESC')
|
||||||
->orderBy('order', 'ASC')
|
->orderBy('order', 'ASC')
|
||||||
->orderBy('updated_at', 'DESC')
|
->orderBy('updated_at', 'DESC')
|
||||||
->get();
|
->get();
|
||||||
@ -328,7 +333,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param RuleGroup $ruleGroup
|
* @param RuleGroup $ruleGroup
|
||||||
* @param array $data
|
* @param array $data
|
||||||
*
|
*
|
||||||
* @return RuleGroup
|
* @return RuleGroup
|
||||||
*/
|
*/
|
||||||
@ -353,4 +358,5 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
|||||||
{
|
{
|
||||||
return $this->user->ruleGroups()->where('title', $title)->first();
|
return $this->user->ruleGroups()->where('title', $title)->first();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user