From 165d2c9f6cc6ff92d7576ba68e7714499fdcd77c Mon Sep 17 00:00:00 2001 From: Matt Young Date: Mon, 3 Nov 2025 07:13:59 -0600 Subject: [PATCH] Fixed issue with results output --- app/Actions/Reports/GetExportData.php | 4 ++-- app/Actions/Tabulation/RankAuditionEntries.php | 10 +++++----- app/Models/Entry.php | 4 ++-- resources/views/entries/index.blade.php | 10 +++++++++- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/Actions/Reports/GetExportData.php b/app/Actions/Reports/GetExportData.php index cd0abe3..c768d4e 100644 --- a/app/Actions/Reports/GetExportData.php +++ b/app/Actions/Reports/GetExportData.php @@ -33,7 +33,7 @@ class GetExportData foreach ($events as $event) { $auditions = $event->auditions; foreach ($auditions as $audition) { - $entries = $ranker->rank('seating', $audition); + $entries = $ranker($audition, 'seating'); foreach ($entries as $entry) { $thisRow = $audition->name.','; $thisRow .= $entry->raw_rank ?? ''; @@ -41,7 +41,7 @@ class GetExportData $thisRow .= $entry->student->full_name().','; $thisRow .= $entry->student->school->name.','; $thisRow .= $entry->student->grade.','; - $thisRow .= $entry->score_totals[0] ?? ''; + $thisRow .= $entry->totalScore->seating_total ?? ''; $thisRow .= ','; if ($entry->hasFlag('failed_prelim')) { $thisRow .= 'Failed Prelim'; diff --git a/app/Actions/Tabulation/RankAuditionEntries.php b/app/Actions/Tabulation/RankAuditionEntries.php index 379fad5..2ea75e5 100644 --- a/app/Actions/Tabulation/RankAuditionEntries.php +++ b/app/Actions/Tabulation/RankAuditionEntries.php @@ -24,7 +24,7 @@ class RankAuditionEntries * * @throws AuditionAdminException */ - public function __invoke(Audition $audition, string $rank_type): Collection|Entry + public function __invoke(Audition $audition, string $rank_type, bool $pullDeclinedEntries = true): Collection|Entry { if ($rank_type !== 'seating' && $rank_type !== 'advancement') { throw new AuditionAdminException('Invalid rank type (must be seating or advancement)'); @@ -33,8 +33,8 @@ class RankAuditionEntries $cache_duration = 15; if ($rank_type === 'seating') { - return cache()->remember('rank_seating_'.$audition->id, $cache_duration, function () use ($audition) { - return $this->get_seating_ranks($audition); + return cache()->remember('rank_seating_'.$audition->id, $cache_duration, function () use ($audition, $pullDeclinedEntries) { + return $this->get_seating_ranks($audition, $pullDeclinedEntries); }); } @@ -44,7 +44,7 @@ class RankAuditionEntries } - private function get_seating_ranks(Audition $audition): Collection|Entry + private function get_seating_ranks(Audition $audition, bool $pullDeclinedEntries = true): Collection|Entry { if ($audition->bonusScore()->count() > 0) { $totalColumn = 'seating_total_with_bonus'; @@ -74,7 +74,7 @@ class RankAuditionEntries $rankOn = 1; foreach ($sortedEntries as $entry) { - if ($entry->hasFlag('declined')) { + if ($entry->hasFlag('declined') && $pullDeclinedEntries) { $entry->seatingRank = 'declined'; } else { $entry->seatingRank = $rankOn; diff --git a/app/Models/Entry.php b/app/Models/Entry.php index a64e1cf..2b8c63d 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -29,7 +29,7 @@ class Entry extends Model /** * @throws AuditionAdminException */ - public function rank(string $type) + public function rank(string $type, bool $pullDeclinedEntries = true) { $ranker = app(RankAuditionEntries::class); @@ -39,7 +39,7 @@ class Entry extends Model } // Get the ranked entries for this entries audition - $rankedEntries = $ranker($this->audition, $type); + $rankedEntries = $ranker($this->audition, $type, $pullDeclinedEntries); // If we're looking for seating rank, return the rank from the list of ranked entries if ($type === 'seating') { diff --git a/resources/views/entries/index.blade.php b/resources/views/entries/index.blade.php index 3416283..9c0703f 100644 --- a/resources/views/entries/index.blade.php +++ b/resources/views/entries/index.blade.php @@ -67,7 +67,12 @@ @endif Edit + + + Seat + + Rank @@ -107,7 +112,7 @@ @endif @endif - + @if($entry->audition->hasFlag('seats_published')) @if($entry->seat) @@ -116,6 +121,9 @@ Not Seated @endif + + {{ $entry->rank('seating', false) }} + @endif