diff --git a/app/Http/Controllers/Tabulation/SeatAuditionFormController.php b/app/Http/Controllers/Tabulation/SeatAuditionFormController.php index 5b879c1..6893a20 100644 --- a/app/Http/Controllers/Tabulation/SeatAuditionFormController.php +++ b/app/Http/Controllers/Tabulation/SeatAuditionFormController.php @@ -53,7 +53,23 @@ class SeatAuditionFormController extends Controller $doubler_data = []; foreach ($scored_entries as $e) { if ($e->student->isDoublerInEvent($audition->event_id)) { - $doubler_data[$e->id] = $e->student->entriesForEvent($e->audition->event_id); + // get the other entries for this student + $doubler_data[$e->id]['entries'] = $e->student->entriesForEvent($e->audition->event_id); + + // How many of this student's entries have been declined + $declined_count = $doubler_data[$e->id]['entries']->filter(function ($entry) { + return $entry->hasFlag('declined'); + })->count(); + + // set status + // declined status is easy + if ($e->hasFlag('declined')) { + $doubler_data[$e->id]['status'] = 'declined'; + } elseif ($doubler_data[$e->id]['entries']->count() - $declined_count == 1) { + $doubler_data[$e->id]['status'] = 'accepted'; + } else { + $doubler_data[$e->id]['status'] = 'undecided'; + } } } diff --git a/resources/views/tabulation/auditionSeating.blade.php b/resources/views/tabulation/auditionSeating.blade.php index 8b10c6c..992817b 100644 --- a/resources/views/tabulation/auditionSeating.blade.php +++ b/resources/views/tabulation/auditionSeating.blade.php @@ -38,7 +38,7 @@ @if( isset($doubler_data[$entry->id]) ) {{-- Check if this entry is a doubler --}} - @foreach($doubler_data[$entry->id] as $de) + @foreach($doubler_data[$entry->id]['entries'] as $de) {{-- If it is, render doubler blocks --}}
{{-- @var \App\Models\Entry $de --}} @@ -60,6 +60,12 @@
@endforeach
+
+ + + + +
@endif @endforeach