Show failed prelim scores on seating page
This commit is contained in:
parent
b2d66eb1b8
commit
31d56e5b90
|
|
@ -69,9 +69,14 @@ class ShowAuditionSeatingPage extends Controller
|
||||||
$query->where('flag_name', 'failed_prelim');
|
$query->where('flag_name', 'failed_prelim');
|
||||||
})
|
})
|
||||||
->with('student.school')
|
->with('student.school')
|
||||||
|
->with('PrelimScoreSheets')
|
||||||
->orderBy('draw_number')
|
->orderBy('draw_number')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
$failed_prelim_entries = $failed_prelim_entries->sortByDesc(function ($entry) {
|
||||||
|
return $entry->prelimTotalScore();
|
||||||
|
});
|
||||||
|
|
||||||
// Get Doublers
|
// Get Doublers
|
||||||
$doublerData = Doubler::where('event_id', $audition->event_id)
|
$doublerData = Doubler::where('event_id', $audition->event_id)
|
||||||
->whereIn('student_id', $scored_entries->pluck('student_id'))
|
->whereIn('student_id', $scored_entries->pluck('student_id'))
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,18 @@ class Entry extends Model
|
||||||
return $this->hasMany(PrelimScoreSheet::class);
|
return $this->hasMany(PrelimScoreSheet::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function prelimTotalScore()
|
||||||
|
{
|
||||||
|
return once(function () {
|
||||||
|
$total = 0;
|
||||||
|
foreach ($this->prelimScoreSheets as $sheet) {
|
||||||
|
$total += $sheet->total;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $total / $this->prelimScoreSheets->count();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function prelimResult()
|
public function prelimResult()
|
||||||
{
|
{
|
||||||
if ($this->hasFlag('passed_prelim')) {
|
if ($this->hasFlag('passed_prelim')) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
<x-table.th>Draw #</x-table.th>
|
<x-table.th>Draw #</x-table.th>
|
||||||
<x-table.th>ID</x-table.th>
|
<x-table.th>ID</x-table.th>
|
||||||
<x-table.th>Student</x-table.th>
|
<x-table.th>Student</x-table.th>
|
||||||
|
<x-table.th>Score</x-table.th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
@ -17,6 +18,7 @@
|
||||||
<span>{{ $entry->student->full_name() }}</span>
|
<span>{{ $entry->student->full_name() }}</span>
|
||||||
<span class="text-xs text-gray-400">{{ $entry->student->school->name }}</span>
|
<span class="text-xs text-gray-400">{{ $entry->student->school->name }}</span>
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
|
<x-table.td>{{ $entry->prelimTotalScore() }}</x-table.td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue