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

@@ -258,29 +258,6 @@ class RuleRepository implements RuleRepositoryInterface
return $filtered;
}
/**
* @param Rule $rule
*
* @return bool
*/
public function moveDown(Rule $rule): bool
{
$order = $rule->order;
// find the rule with order+1 and give it order-1
$other = $rule->ruleGroup->rules()->where('order', $order + 1)->first();
if ($other) {
--$other->order;
$other->save();
}
++$rule->order;
$rule->save();
$this->resetRuleOrder($rule->ruleGroup);
return true;
}
/**
* @inheritDoc
*/
@@ -295,29 +272,6 @@ class RuleRepository implements RuleRepositoryInterface
return $rule;
}
/**
* @param Rule $rule
*
* @return bool
*/
public function moveUp(Rule $rule): bool
{
$order = $rule->order;
// find the rule with order-1 and give it order+1
$other = $rule->ruleGroup->rules()->where('order', $order - 1)->first();
if ($other) {
++$other->order;
$other->save();
}
--$rule->order;
$rule->save();
$this->resetRuleOrder($rule->ruleGroup);
return true;
}
/**
* @param Rule $rule
* @param array $ids

View File

@@ -123,13 +123,6 @@ interface RuleRepositoryInterface
*/
public function getUpdateRules(): Collection;
/**
* @param Rule $rule
*
* @return bool
*/
public function moveDown(Rule $rule): bool;
/**
* @param Rule $rule
* @param RuleGroup $ruleGroup
@@ -139,13 +132,6 @@ interface RuleRepositoryInterface
*/
public function moveRule(Rule $rule, RuleGroup $ruleGroup, int $order): Rule;
/**
* @param Rule $rule
*
* @return bool
*/
public function moveUp(Rule $rule): bool;
/**
* @param Rule $rule
* @param array $ids