Results Table working on advancement

This commit is contained in:
Matt Young 2024-07-14 00:26:24 -05:00
parent cdb7f9b04f
commit 3c9a890be3
3 changed files with 14 additions and 11 deletions

View File

@ -46,7 +46,6 @@ class CalculateScoreSheetTotal
$finalScore = $scoreTotal / $weightsTotal; $finalScore = $scoreTotal / $weightsTotal;
// put $final score at the beginning of the $ScoreArray // put $final score at the beginning of the $ScoreArray
array_unshift($scoreArray, $finalScore); array_unshift($scoreArray, $finalScore);
return $scoreArray; return $scoreArray;
} }

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers\Tabulation; namespace App\Http\Controllers\Tabulation;
use App\Actions\Tabulation\RankAuditionEntries;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Audition; use App\Models\Audition;
use App\Models\Entry; use App\Models\Entry;
@ -9,9 +10,10 @@ use Illuminate\Http\Request;
class AdvancementController extends Controller class AdvancementController extends Controller
{ {
public function __construct() protected RankAuditionEntries $ranker;
public function __construct(RankAuditionEntries $ranker)
{ {
$this->ranker = $ranker;
} }
public function status() public function status()
@ -51,7 +53,7 @@ class AdvancementController extends Controller
public function ranking(Request $request, Audition $audition) public function ranking(Request $request, Audition $audition)
{ {
$entries = $this->tabulationService->auditionEntries($audition->id, 'advancement'); $entries = $this->ranker->rank('advancement', $audition);
$entries->load('advancementVotes'); $entries->load('advancementVotes');
$scoringComplete = $entries->every(function ($entry) { $scoringComplete = $entries->every(function ($entry) {

View File

@ -7,7 +7,6 @@
<x-table.th>Draw #</x-table.th> <x-table.th>Draw #</x-table.th>
<x-table.th>Student Name</x-table.th> <x-table.th>Student Name</x-table.th>
<x-table.th>Total Score</x-table.th> <x-table.th>Total Score</x-table.th>
<x-table.th>All Scores?</x-table.th>
<x-table.th>Votes</x-table.th> <x-table.th>Votes</x-table.th>
@if($scoringComplete) @if($scoringComplete)
<x-table.th>Pass?</x-table.th> <x-table.th>Pass?</x-table.th>
@ -17,6 +16,13 @@
<x-table.body> <x-table.body>
@foreach($entries as $entry) @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
<tr> <tr>
<x-table.td>{{ $entry->rank }}</x-table.td> <x-table.td>{{ $entry->rank }}</x-table.td>
<x-table.td>{{ $entry->id }}</x-table.td> <x-table.td>{{ $entry->id }}</x-table.td>
@ -25,12 +31,8 @@
<span>{{ $entry->student->full_name() }}</span> <span>{{ $entry->student->full_name() }}</span>
<span class="text-xs text-gray-400">{{ $entry->student->school->name }}</span> <span class="text-xs text-gray-400">{{ $entry->student->school->name }}</span>
</x-table.td> </x-table.td>
<x-table.td>{{ number_format($entry->final_score_array[0] ?? 0,4) }}</x-table.td> <x-table.td>{{ $score }}</x-table.td>
<x-table.td>
@if($entry->scoring_complete)
<x-icons.checkmark color="green"/>
@endif
</x-table.td>
<x-table.td class="flex space-x-1"> <x-table.td class="flex space-x-1">
@foreach($entry->advancementVotes as $vote) @foreach($entry->advancementVotes as $vote)
<div x-data="{ showJudgeName: false, timeout: null }" <div x-data="{ showJudgeName: false, timeout: null }"