Update TotalEntryScores action to recognize an insufficient number of judges.

This commit is contained in:
Matt Young 2025-06-30 08:27:54 -05:00
parent 790f725342
commit 9cf025154a
1 changed files with 3 additions and 2 deletions

View File

@ -34,8 +34,9 @@ class TotalEntryScores
// deal with seating scores // deal with seating scores
// TODO: Consider a rewrite to pull the scoreSheets from the entry model so they may be preloaded // TODO: Consider a rewrite to pull the scoreSheets from the entry model so they may be preloaded
$scoreSheets = ScoreSheet::where('entry_id', $entry->id)->orderBy('seating_total', 'desc')->get(); $scoreSheets = ScoreSheet::where('entry_id', $entry->id)->orderBy('seating_total', 'desc')->get();
// bail out if there are no score sheets // bail out if there are not enough score sheets
if ($scoreSheets->count() == 0) { $assignedJudges = $entry->audition->judges()->count();
if ($scoreSheets->count() == 0 || $scoreSheets->count() < $assignedJudges) {
return; return;
} }
if (auditionSetting('olympic_scoring' && $scoreSheets->count() > 2)) { if (auditionSetting('olympic_scoring' && $scoreSheets->count() > 2)) {