Fix bug when no scores exist for an entry
This commit is contained in:
parent
856c254dd1
commit
51e59256ef
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue