From 3c9a890be317dd8776504dc63102686d170149eb Mon Sep 17 00:00:00 2001 From: Matt Young Date: Sun, 14 Jul 2024 00:26:24 -0500 Subject: [PATCH] Results Table working on advancement --- .../Tabulation/CalculateScoreSheetTotal.php | 1 - .../Tabulation/AdvancementController.php | 8 +++++--- .../advancement/results-table.blade.php | 16 +++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/app/Actions/Tabulation/CalculateScoreSheetTotal.php b/app/Actions/Tabulation/CalculateScoreSheetTotal.php index 3d2d506..322aec0 100644 --- a/app/Actions/Tabulation/CalculateScoreSheetTotal.php +++ b/app/Actions/Tabulation/CalculateScoreSheetTotal.php @@ -46,7 +46,6 @@ class CalculateScoreSheetTotal $finalScore = $scoreTotal / $weightsTotal; // put $final score at the beginning of the $ScoreArray array_unshift($scoreArray, $finalScore); - return $scoreArray; } diff --git a/app/Http/Controllers/Tabulation/AdvancementController.php b/app/Http/Controllers/Tabulation/AdvancementController.php index e0abc34..7120070 100644 --- a/app/Http/Controllers/Tabulation/AdvancementController.php +++ b/app/Http/Controllers/Tabulation/AdvancementController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Tabulation; +use App\Actions\Tabulation\RankAuditionEntries; use App\Http\Controllers\Controller; use App\Models\Audition; use App\Models\Entry; @@ -9,9 +10,10 @@ use Illuminate\Http\Request; class AdvancementController extends Controller { - public function __construct() + protected RankAuditionEntries $ranker; + public function __construct(RankAuditionEntries $ranker) { - + $this->ranker = $ranker; } public function status() @@ -51,7 +53,7 @@ class AdvancementController extends Controller public function ranking(Request $request, Audition $audition) { - $entries = $this->tabulationService->auditionEntries($audition->id, 'advancement'); + $entries = $this->ranker->rank('advancement', $audition); $entries->load('advancementVotes'); $scoringComplete = $entries->every(function ($entry) { diff --git a/resources/views/tabulation/advancement/results-table.blade.php b/resources/views/tabulation/advancement/results-table.blade.php index 049e6e3..4c024aa 100644 --- a/resources/views/tabulation/advancement/results-table.blade.php +++ b/resources/views/tabulation/advancement/results-table.blade.php @@ -7,7 +7,6 @@ Draw # Student Name Total Score - All Scores? Votes @if($scoringComplete) Pass? @@ -17,6 +16,13 @@ @foreach($entries as $entry) + @php + if ($entry->score_totals[0] < 0) { + $score = $entry->score_message; + } else { + $score = number_format($entry->score_totals[0] ?? 0,4); + } + @endphp {{ $entry->rank }} {{ $entry->id }} @@ -25,12 +31,8 @@ {{ $entry->student->full_name() }} {{ $entry->student->school->name }} - {{ number_format($entry->final_score_array[0] ?? 0,4) }} - - @if($entry->scoring_complete) - - @endif - + {{ $score }} + @foreach($entry->advancementVotes as $vote)