Work toward being able to check if an audition is seatable

This commit is contained in:
Matt Young 2024-06-21 21:16:25 -05:00
parent bf3313bf30
commit 2169afdb0b
4 changed files with 29 additions and 6 deletions

View File

@ -31,7 +31,24 @@ class TabulationController extends Controller
public function auditionSeating(Audition $audition) public function auditionSeating(Audition $audition)
{ {
$entries = $this->tabulationService->auditionEntries($audition->id); $entries = $this->tabulationService->auditionEntries($audition->id);
$complete = true;
$doublerComplete = true;
foreach ($entries as $entry) {
if (! $entry->scoring_complete) {
$complete = false;
}
return view('tabulation.auditionSeating', compact('audition', 'entries')); if ($this->doublerService->studentIsDoubler($entry->student_id)) { // If this entry is a doubler
if ($this->doublerService->getDoublerInfo($entry->student_id)[$entry->id]['status']) { // If there is no decision for this entry
$doublerComplete = false;
}
}
}
$complete = $entries->every(function ($entry) {
return $entry->scoring_complete;
});
return view('tabulation.auditionSeating', compact('audition', 'entries', 'complete', 'doublerComplete'));
} }
} }

View File

@ -103,9 +103,14 @@ class ScoreService
*/ */
public function calculateScoresForAudition($auditionId) public function calculateScoresForAudition($auditionId)
{ {
static $alreadyChecked = [];
// if $auditionId is in the array $alreadyChecked return
if (in_array($auditionId, $alreadyChecked)) {
return;
}
$alreadyChecked[] = $auditionId;
$audition = $this->auditionCache->getAudition($auditionId); $audition = $this->auditionCache->getAudition($auditionId);
$scoringGuideId = $audition->scoring_guide_id; $scoringGuideId = $audition->scoring_guide_id;
// $entries = Entry::where('audition_id',$auditionId)->with('scoreSheets')->get();
$entries = $this->entryCache->getEntriesForAudition($auditionId); $entries = $this->entryCache->getEntriesForAudition($auditionId);
$entries->load('scoreSheets'); // TODO Cache this somehow, it's expensive and repetitive on the seating page $entries->load('scoreSheets'); // TODO Cache this somehow, it's expensive and repetitive on the seating page

View File

@ -21,8 +21,8 @@
<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>
<x-table.td>{{ $entry->draw_number }}</x-table.td> <x-table.td>{{ $entry->draw_number }}</x-table.td>
<x-table.td> <x-table.td class="flex flex-col">
<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 class="!py-0"> <x-table.td class="!py-0">

View File

@ -13,9 +13,10 @@
Seating Form Seating Form
</x-card.heading> </x-card.heading>
<div class="pl-3"> <div class="pl-3">
@foreach($entries as $entry) @foreach($entries as $entry)
{{ dump($entry) }} @if(! $entry->scoring_complete)
Entry {{ $entry->id }} is unscored.
@endif
@endforeach @endforeach
</div> </div>
</x-card.card> </x-card.card>