Count noshows as a scored entry on audition status list.
This commit is contained in:
parent
fb9efa0564
commit
93d4305131
|
|
@ -14,22 +14,29 @@ class SeatingStatusController extends Controller
|
|||
public function __invoke(Request $request)
|
||||
{
|
||||
$auditions = Audition::forSeating()
|
||||
->withCount(['entries'=> function ($query) {
|
||||
$query->where('for_seating', 1);
|
||||
}])
|
||||
->withCount(['unscoredEntries'=>function ($query) {
|
||||
$query->where('for_seating', 1);
|
||||
}])
|
||||
->withCount([
|
||||
'entries' => function ($query) {
|
||||
$query->where('for_seating', 1);
|
||||
},
|
||||
])
|
||||
->withCount([
|
||||
'unscoredEntries' => function ($query) {
|
||||
$query->where('for_seating', 1);
|
||||
},
|
||||
])
|
||||
->with('flags')
|
||||
->get();
|
||||
$auditionData = [];
|
||||
foreach ($auditions as $audition) {
|
||||
$noShowCount = $audition->entries->filter(function ($entry) {
|
||||
return $entry->hasFlag('no_show');
|
||||
})->count();
|
||||
$auditionData[$audition->id] = [
|
||||
'id' => $audition->id,
|
||||
'name' => $audition->name,
|
||||
'scoredEntriesCount' => $audition->entries_count - $audition->unscored_entries_count,
|
||||
'scoredEntriesCount' => $audition->entries_count - $audition->unscored_entries_count + $noShowCount,
|
||||
'totalEntriesCount' => $audition->entries_count,
|
||||
'scoredPercentage' => $audition->entries_count > 0 ? ($audition->entries_count - $audition->unscored_entries_count) / $audition->entries_count * 100 : 100,
|
||||
'scoredPercentage' => $audition->entries_count > 0 ? ($audition->entries_count - $audition->unscored_entries_count + $noShowCount) / $audition->entries_count * 100 : 100,
|
||||
'scoringComplete' => $audition->unscored_entries_count === 0,
|
||||
'seatsPublished' => $audition->hasFlag('seats_published'),
|
||||
'audition' => $audition,
|
||||
|
|
|
|||
Loading…
Reference in New Issue