From 66283ac440fe24b829fe84045e6ed5032b9cad76 Mon Sep 17 00:00:00 2001 From: Venix <30481900+venix12@users.noreply.github.com> Date: Mon, 13 Jan 2025 09:34:30 +0100 Subject: [PATCH] remove redundant function --- app/Models/Season.php | 8 -------- app/Models/UserSeasonScoreAggregate.php | 3 ++- 2 files changed, 2 insertions(+), 9 deletions(-) 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);