Small bugfixes for issues in beta 2

This commit is contained in:
James Cole
2021-03-15 07:45:46 +01:00
parent b9bf5c9856
commit 8d84dfb3aa
16 changed files with 99 additions and 192 deletions

View File

@@ -277,52 +277,6 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
return (int)$this->user->ruleGroups()->max('order');
}
/**
* @param RuleGroup $ruleGroup
*
* @return bool
*/
public function moveDown(RuleGroup $ruleGroup): bool
{
$order = $ruleGroup->order;
// find the rule with order+1 and give it order-1
$other = $this->user->ruleGroups()->where('order', $order + 1)->first();
if ($other) {
--$other->order;
$other->save();
}
++$ruleGroup->order;
$ruleGroup->save();
$this->resetRuleGroupOrder();
return true;
}
/**
* @param RuleGroup $ruleGroup
*
* @return bool
*/
public function moveUp(RuleGroup $ruleGroup): bool
{
$order = $ruleGroup->order;
// find the rule with order-1 and give it order+1
$other = $this->user->ruleGroups()->where('order', $order - 1)->first();
if ($other) {
++$other->order;
$other->save();
}
--$ruleGroup->order;
$ruleGroup->save();
$this->resetRuleGroupOrder();
return true;
}
/**
* @return bool
*/

View File

@@ -128,20 +128,6 @@ interface RuleGroupRepositoryInterface
*/
public function maxOrder(): int;
/**
* @param RuleGroup $ruleGroup
*
* @return bool
*/
public function moveDown(RuleGroup $ruleGroup): bool;
/**
* @param RuleGroup $ruleGroup
*
* @return bool
*/
public function moveUp(RuleGroup $ruleGroup): bool;
/**
* @return bool
*/