T-shirt by school for SCOBDA - deal with school with no entries
This commit is contained in:
parent
5d93ba0799
commit
65b8c8bd81
|
|
@ -23,7 +23,8 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
||||||
$schools = School::all();
|
$schools = School::all();
|
||||||
|
|
||||||
return view('nomination_ensembles.scobda.admin.seating.index',
|
return view('nomination_ensembles.scobda.admin.seating.index',
|
||||||
compact('ensembles', 'ensemble', 'shirtReportType', 'shirtCounts', 'schoolShirtCounts', 'shirtSizes', 'schools'));
|
compact('ensembles', 'ensemble', 'shirtReportType', 'shirtCounts', 'schoolShirtCounts', 'shirtSizes',
|
||||||
|
'schools'));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function totalShirtCount()
|
protected function totalShirtCount()
|
||||||
|
|
@ -52,11 +53,13 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
||||||
->get();
|
->get();
|
||||||
$schoolShirtCounts = [];
|
$schoolShirtCounts = [];
|
||||||
foreach ($acceptedNominationEntries as $entry) {
|
foreach ($acceptedNominationEntries as $entry) {
|
||||||
if (! isset($schoolShirtCounts[$entry->student->school->id])) {
|
$shirtSize = $entry->student->optional_data['shirt_size'] ?? 'none';
|
||||||
$schoolShirtCounts[$entry->student->school->id] = [];
|
$schoolId = $entry->student->school->id;
|
||||||
|
if (! isset($schoolShirtCounts[$schoolId])) {
|
||||||
|
$schoolShirtCounts[$schoolId] = [];
|
||||||
}
|
}
|
||||||
$schoolShirtCounts[$entry->student->school->id][$entry->student->optional_data['shirt_size']] =
|
$schoolShirtCounts[$schoolId][$shirtSize] =
|
||||||
($schoolShirtCounts[$entry->student->school->id][$entry->student->optional_data['shirt_size']] ?? 0) + 1;
|
($schoolShirtCounts[$schoolId][$shirtSize] ?? 0) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $schoolShirtCounts;
|
return $schoolShirtCounts;
|
||||||
|
|
@ -64,6 +67,8 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
||||||
|
|
||||||
public function show(NominationEnsemble $ensemble)
|
public function show(NominationEnsemble $ensemble)
|
||||||
{
|
{
|
||||||
|
$shirtReportType = request()->get('shirtReportType') ?? 'none';
|
||||||
|
|
||||||
$ensembles = NominationEnsemble::all();
|
$ensembles = NominationEnsemble::all();
|
||||||
$acceptedNominations = NominationEnsembleEntry::where('nomination_ensemble_id', $ensemble->id)
|
$acceptedNominations = NominationEnsembleEntry::where('nomination_ensemble_id', $ensemble->id)
|
||||||
->where('data->accepted', true)
|
->where('data->accepted', true)
|
||||||
|
|
@ -74,7 +79,7 @@ class ScobdaNominationSeatingController extends Controller implements Nomination
|
||||||
});
|
});
|
||||||
|
|
||||||
return view('nomination_ensembles.scobda.admin.seating.index',
|
return view('nomination_ensembles.scobda.admin.seating.index',
|
||||||
compact('ensembles', 'ensemble', 'acceptedNominations'));
|
compact('ensembles', 'ensemble', 'acceptedNominations', 'shirtReportType'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue