Correctly show number of unscored entries on seating page doubler blocks.
This commit is contained in:
parent
0b5a5ba722
commit
9eaccbce95
|
|
@ -34,9 +34,9 @@ class SeatingStatusController extends Controller
|
|||
$auditionData[$audition->id] = [
|
||||
'id' => $audition->id,
|
||||
'name' => $audition->name,
|
||||
'scoredEntriesCount' => $audition->entries_count - $audition->unscored_entries_count + $noShowCount,
|
||||
'scoredEntriesCount' => $audition->entries_count - $audition->unscored_entries_count,
|
||||
'totalEntriesCount' => $audition->entries_count,
|
||||
'scoredPercentage' => $audition->entries_count > 0 ? ($audition->entries_count - $audition->unscored_entries_count + $noShowCount) / $audition->entries_count * 100 : 100,
|
||||
'scoredPercentage' => $audition->entries_count > 0 ? ($audition->entries_count - $audition->unscored_entries_count) / $audition->entries_count * 100 : 100,
|
||||
'scoringComplete' => $audition->unscored_entries_count === 0,
|
||||
'seatsPublished' => $audition->hasFlag('seats_published'),
|
||||
'audition' => $audition,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,10 @@ class Audition extends Model
|
|||
public function unscoredEntries(): HasMany
|
||||
{
|
||||
return $this->hasMany(Entry::class)
|
||||
->whereDoesntHave('scoreSheets');
|
||||
->whereDoesntHave('scoreSheets')
|
||||
->whereDoesntHave('flags', function ($query) {
|
||||
$query->where('flag_name', 'no_show');
|
||||
});
|
||||
}
|
||||
|
||||
public function room(): BelongsTo
|
||||
|
|
|
|||
|
|
@ -40,7 +40,18 @@ class DoublerService
|
|||
protected function findDoublersForEvent(Event $event, string $mode = 'seating'): array
|
||||
{
|
||||
$this->validateEvent($event);
|
||||
$entries = $event->entries()->with('audition')->with('student')->get();
|
||||
$entries = $event->entries()
|
||||
->with([
|
||||
'audition' => function ($query) {
|
||||
$query->withCount([
|
||||
'unscoredEntries' => function ($query) {
|
||||
$query->where('for_seating', 1);
|
||||
},
|
||||
]);
|
||||
},
|
||||
])
|
||||
->with('student')
|
||||
->get();
|
||||
$entries = match ($mode) {
|
||||
'seating' => $entries->filter(fn ($entry) => $entry->for_seating === 1),
|
||||
'advancement' => $entries->filter(fn ($entry) => $entry->for_advance === 1),
|
||||
|
|
|
|||
Loading…
Reference in New Issue