diff --git a/app/Models/Season.php b/app/Models/Season.php index 9981d7e3f35..f3ce08685cf 100644 --- a/app/Models/Season.php +++ b/app/Models/Season.php @@ -52,14 +52,6 @@ public function endDate(): ?Carbon : null; } - public function scoreFactorsOrderedForCalculation(): array - { - $factors = $this->score_factors ?? []; - rsort($factors); - - return $factors; - } - public function startDate(): ?Carbon { return $this->rooms->min('starts_at'); diff --git a/app/Models/UserSeasonScoreAggregate.php b/app/Models/UserSeasonScoreAggregate.php index a8052380029..62bcd1cb96b 100644 --- a/app/Models/UserSeasonScoreAggregate.php +++ b/app/Models/UserSeasonScoreAggregate.php @@ -35,7 +35,7 @@ public function calculate(bool $muteExceptions = true): void ->where('user_id', $this->user_id) ->get(); - $factors = $this->season->scoreFactorsOrderedForCalculation(); + $factors = $this->season->score_factors; $roomsGrouped = $rooms->groupBy('pivot.group_indicator'); if ($roomsGrouped->count() > count($factors)) { @@ -59,6 +59,7 @@ public function calculate(bool $muteExceptions = true): void $scores[] = $groupUserScores->max(); } + rsort($factors); rsort($scores); $scoreCount = count($scores);