mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-09 23:53:12 -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();
|
||||
$this->createDefaultRuleGroup();
|
||||
$this->createDefaultRule();
|
||||
$this->ruleGroupRepos->resetRuleGroupOrder();
|
||||
$ruleGroups = $this->ruleGroupRepos->getRuleGroupsWithRules($user);
|
||||
|
||||
return view('rules.index', compact('ruleGroups'));
|
||||
|
@ -56,7 +56,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
* @param RuleGroup $ruleGroup
|
||||
* @param RuleGroup|null $moveTo
|
||||
*
|
||||
* @return bool
|
||||
@ -98,6 +98,10 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
foreach ($set as $entry) {
|
||||
$entry->order = $count;
|
||||
$entry->save();
|
||||
|
||||
// also update rules in group.
|
||||
$this->resetRulesInGroupOrder($entry);
|
||||
|
||||
++$count;
|
||||
}
|
||||
|
||||
@ -114,6 +118,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
$ruleGroup->rules()->whereNotNull('deleted_at')->update(['order' => 0]);
|
||||
|
||||
$set = $ruleGroup->rules()
|
||||
->orderBy('active','DESC')
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('updated_at', 'DESC')
|
||||
->get();
|
||||
@ -328,7 +333,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param RuleGroup $ruleGroup
|
||||
* @param array $data
|
||||
* @param array $data
|
||||
*
|
||||
* @return RuleGroup
|
||||
*/
|
||||
@ -353,4 +358,5 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
{
|
||||
return $this->user->ruleGroups()->where('title', $title)->first();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user