mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-25 14:58:40 +00:00
Reset rule order on index. #3376
This commit is contained in:
@@ -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'));
|
||||||
|
@@ -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();
|
||||||
@@ -353,4 +358,5 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
|||||||
{
|
{
|
||||||
return $this->user->ruleGroups()->where('title', $title)->first();
|
return $this->user->ruleGroups()->where('title', $title)->first();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user