diff --git a/app/Http/Controllers/Tabulation/TabulationController.php b/app/Http/Controllers/Tabulation/TabulationController.php index 3d8b369..e0f2921 100644 --- a/app/Http/Controllers/Tabulation/TabulationController.php +++ b/app/Http/Controllers/Tabulation/TabulationController.php @@ -31,7 +31,24 @@ class TabulationController extends Controller public function auditionSeating(Audition $audition) { $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')); } } diff --git a/app/Services/ScoreService.php b/app/Services/ScoreService.php index dc7d5e9..ad3ec19 100644 --- a/app/Services/ScoreService.php +++ b/app/Services/ScoreService.php @@ -103,9 +103,14 @@ class ScoreService */ 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); $scoringGuideId = $audition->scoring_guide_id; - // $entries = Entry::where('audition_id',$auditionId)->with('scoreSheets')->get(); $entries = $this->entryCache->getEntriesForAudition($auditionId); $entries->load('scoreSheets'); // TODO Cache this somehow, it's expensive and repetitive on the seating page diff --git a/resources/views/tabulation/audition-results-table.blade.php b/resources/views/tabulation/audition-results-table.blade.php index 7b571f0..5b5b0c5 100644 --- a/resources/views/tabulation/audition-results-table.blade.php +++ b/resources/views/tabulation/audition-results-table.blade.php @@ -21,8 +21,8 @@ {{ $entry->rank }} {{ $entry->id }} {{ $entry->draw_number }} - - {{ $entry->student->full_name() }}, + + {{ $entry->student->full_name() }} {{ $entry->student->school->name }} diff --git a/resources/views/tabulation/auditionSeating.blade.php b/resources/views/tabulation/auditionSeating.blade.php index 8eb733a..ca91543 100644 --- a/resources/views/tabulation/auditionSeating.blade.php +++ b/resources/views/tabulation/auditionSeating.blade.php @@ -13,9 +13,10 @@ Seating Form
- @foreach($entries as $entry) - {{ dump($entry) }} + @if(! $entry->scoring_complete) + Entry {{ $entry->id }} is unscored. + @endif @endforeach