From f5db2eae787a2072f47d9a8a5c4c02c7f65fdffb Mon Sep 17 00:00:00 2001 From: Matt Young Date: Wed, 26 Jun 2024 15:58:54 -0500 Subject: [PATCH] Add ceckboxes to advancement page and form to autmoatcially check X boxes --- .../Tabulation/AdvancementController.php | 9 +++-- app/Services/TabulationService.php | 9 +++-- .../views/components/form/checkbox.blade.php | 10 +++-- .../tabulation/advancement/ranking.blade.php | 40 ++++++++++++++----- .../advancement/results-table.blade.php | 21 ++++++++++ 5 files changed, 67 insertions(+), 22 deletions(-) diff --git a/app/Http/Controllers/Tabulation/AdvancementController.php b/app/Http/Controllers/Tabulation/AdvancementController.php index 4626872..0ab0e21 100644 --- a/app/Http/Controllers/Tabulation/AdvancementController.php +++ b/app/Http/Controllers/Tabulation/AdvancementController.php @@ -25,11 +25,12 @@ class AdvancementController extends Controller public function ranking(Request $request, Audition $audition) { - $entries = $this->tabulationService->auditionEntries($audition->id); - $entries = $entries->filter(function ($entry) { - return $entry->for_advancement; + $entries = $this->tabulationService->auditionEntries($audition->id, 'advancement'); + + $scoringComplete = $entries->every(function ($entry) { + return $entry->scoring_complete; }); - return view('tabulation.advancement.ranking', compact('audition', 'entries')); + return view('tabulation.advancement.ranking', compact('audition', 'entries','scoringComplete')); } } diff --git a/app/Services/TabulationService.php b/app/Services/TabulationService.php index 822ff14..e8899f2 100644 --- a/app/Services/TabulationService.php +++ b/app/Services/TabulationService.php @@ -54,7 +54,7 @@ class TabulationService $audition = $this->auditionCacheService->getAudition($auditionId); $entries = $this->entryCacheService->getEntriesForAudition($auditionId, $mode); $this->scoreService->calculateScoresForAudition($auditionId); - + // TODO will need to pass a mode to the above function to only use subscores for hte appropriate mode foreach ($entries as $entry) { $entry->final_score_array = $this->scoreService->entryTotalScores($entry); $entry->scoring_complete = ($this->scoreService->entryScoreSheetCounts()[$entry->id] == $audition->judges_count); @@ -69,18 +69,20 @@ class TabulationService return 0; }); - //TODO verify this actually sorts by subscores correctly + + // Assign a rank to each entry. In the case of a declined seat by a doubler, indicate as so and do not increment rank $n = 1; /** @var Entry $entry */ foreach ($entries as $entry) { - if (! $entry->hasFlag('declined')) { + if (! $entry->hasFlag('declined') or $mode != 'seating') { $entry->rank = $n; $n++; } else { $entry->rank = $n.' - declined'; } } + $cache[$auditionId] = $entries->keyBy('id'); return $entries->keyBy('id'); @@ -167,7 +169,6 @@ class TabulationService $audition->scored_entries_count = $scored_entries_count; } - return $auditions; }); diff --git a/resources/views/components/form/checkbox.blade.php b/resources/views/components/form/checkbox.blade.php index ac46979..ea0af3a 100644 --- a/resources/views/components/form/checkbox.blade.php +++ b/resources/views/components/form/checkbox.blade.php @@ -1,4 +1,4 @@ -@props(['name','label','description' => '', 'checked' => false]) +@props(['name','label' => false,'description' => '', 'checked' => false])
+ {{ $attributes->merge(['class' => "h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600"]) }}>
- -

{{ $description }}

+ @if($label) + +

{{ $description }}

+ @endif @error($name)

{{ $message }}

@enderror diff --git a/resources/views/tabulation/advancement/ranking.blade.php b/resources/views/tabulation/advancement/ranking.blade.php index e6b1f65..e730d41 100644 --- a/resources/views/tabulation/advancement/ranking.blade.php +++ b/resources/views/tabulation/advancement/ranking.blade.php @@ -1,22 +1,42 @@ {{ auditionSetting('advanceTo') }} Advancement - {{ $audition->name }} -
-
+
@include('tabulation.advancement.results-table')
-{{-- @if($audition->hasFlag('seats_published'))--}} -{{-- @include('tabulation.auditionSeating-show-published-seats')--}} -{{-- @elseif(! $auditionComplete)--}} -{{-- @include('tabulation.auditionSeating-unable-to-seat-card')--}} -{{-- @else--}} -{{-- @include('tabulation.auditionSeating-fill-seats-form')--}} -{{-- @include('tabulation.auditionSeating-show-proposed-seats')--}} -{{-- @endif--}} + @if($scoringComplete) + + Pass Entries +
+ +
+
+ Mark +
+
+
+ @endif
+ +
diff --git a/resources/views/tabulation/advancement/results-table.blade.php b/resources/views/tabulation/advancement/results-table.blade.php index ca825be..4d602d8 100644 --- a/resources/views/tabulation/advancement/results-table.blade.php +++ b/resources/views/tabulation/advancement/results-table.blade.php @@ -8,6 +8,9 @@ Student Name Total Score All Scores? + @if($scoringComplete) + Pass? + @endif @@ -15,6 +18,24 @@ @foreach($entries as $entry) {{ $entry->rank }} + {{ $entry->id }} + {{ $entry->draw_number }} + + {{ $entry->student->full_name() }} + {{ $entry->student->school->name }} + + {{ number_format($entry->final_score_array[0] ?? 0,4) }} + + @if($entry->scoring_complete) + + @endif + + @if($scoringComplete) + + + + @endif + @endforeach