Fix bug when no scores exist for an entry

This commit is contained in:
Matt Young 2024-06-15 15:33:25 -05:00
parent 856c254dd1
commit 51e59256ef
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@ class TabulationService
// Iterate over the auditions and calculate the scored_entries_count
return $auditions->map(function ($audition) use ($scoreCountByEntry) {
$audition->scored_entries_count = $audition->entries->reduce(function ($carry, $entry) use ($audition, $scoreCountByEntry) {
$entry->fully_scored = $audition->judges_count == $scoreCountByEntry[$entry->id];
$entry->fully_scored = $audition->judges_count == $scoreCountByEntry->has($entry->id) ? $scoreCountByEntry[$entry->id] : false;
return $carry + ($entry->fully_scored ? 1 : 0);
}, 0);
return $audition;