Fixed issue with results output

This commit is contained in:
Matt Young 2025-11-03 07:13:59 -06:00
parent 3208b31524
commit 165d2c9f6c
4 changed files with 18 additions and 10 deletions

View File

@ -33,7 +33,7 @@ class GetExportData
foreach ($events as $event) { foreach ($events as $event) {
$auditions = $event->auditions; $auditions = $event->auditions;
foreach ($auditions as $audition) { foreach ($auditions as $audition) {
$entries = $ranker->rank('seating', $audition); $entries = $ranker($audition, 'seating');
foreach ($entries as $entry) { foreach ($entries as $entry) {
$thisRow = $audition->name.','; $thisRow = $audition->name.',';
$thisRow .= $entry->raw_rank ?? ''; $thisRow .= $entry->raw_rank ?? '';
@ -41,7 +41,7 @@ class GetExportData
$thisRow .= $entry->student->full_name().','; $thisRow .= $entry->student->full_name().',';
$thisRow .= $entry->student->school->name.','; $thisRow .= $entry->student->school->name.',';
$thisRow .= $entry->student->grade.','; $thisRow .= $entry->student->grade.',';
$thisRow .= $entry->score_totals[0] ?? ''; $thisRow .= $entry->totalScore->seating_total ?? '';
$thisRow .= ','; $thisRow .= ',';
if ($entry->hasFlag('failed_prelim')) { if ($entry->hasFlag('failed_prelim')) {
$thisRow .= 'Failed Prelim'; $thisRow .= 'Failed Prelim';

View File

@ -24,7 +24,7 @@ class RankAuditionEntries
* *
* @throws AuditionAdminException * @throws AuditionAdminException
*/ */
public function __invoke(Audition $audition, string $rank_type): Collection|Entry public function __invoke(Audition $audition, string $rank_type, bool $pullDeclinedEntries = true): Collection|Entry
{ {
if ($rank_type !== 'seating' && $rank_type !== 'advancement') { if ($rank_type !== 'seating' && $rank_type !== 'advancement') {
throw new AuditionAdminException('Invalid rank type (must be seating or advancement)'); throw new AuditionAdminException('Invalid rank type (must be seating or advancement)');
@ -33,8 +33,8 @@ class RankAuditionEntries
$cache_duration = 15; $cache_duration = 15;
if ($rank_type === 'seating') { if ($rank_type === 'seating') {
return cache()->remember('rank_seating_'.$audition->id, $cache_duration, function () use ($audition) { return cache()->remember('rank_seating_'.$audition->id, $cache_duration, function () use ($audition, $pullDeclinedEntries) {
return $this->get_seating_ranks($audition); return $this->get_seating_ranks($audition, $pullDeclinedEntries);
}); });
} }
@ -44,7 +44,7 @@ class RankAuditionEntries
} }
private function get_seating_ranks(Audition $audition): Collection|Entry private function get_seating_ranks(Audition $audition, bool $pullDeclinedEntries = true): Collection|Entry
{ {
if ($audition->bonusScore()->count() > 0) { if ($audition->bonusScore()->count() > 0) {
$totalColumn = 'seating_total_with_bonus'; $totalColumn = 'seating_total_with_bonus';
@ -74,7 +74,7 @@ class RankAuditionEntries
$rankOn = 1; $rankOn = 1;
foreach ($sortedEntries as $entry) { foreach ($sortedEntries as $entry) {
if ($entry->hasFlag('declined')) { if ($entry->hasFlag('declined') && $pullDeclinedEntries) {
$entry->seatingRank = 'declined'; $entry->seatingRank = 'declined';
} else { } else {
$entry->seatingRank = $rankOn; $entry->seatingRank = $rankOn;

View File

@ -29,7 +29,7 @@ class Entry extends Model
/** /**
* @throws AuditionAdminException * @throws AuditionAdminException
*/ */
public function rank(string $type) public function rank(string $type, bool $pullDeclinedEntries = true)
{ {
$ranker = app(RankAuditionEntries::class); $ranker = app(RankAuditionEntries::class);
@ -39,7 +39,7 @@ class Entry extends Model
} }
// Get the ranked entries for this entries audition // Get the ranked entries for this entries audition
$rankedEntries = $ranker($this->audition, $type); $rankedEntries = $ranker($this->audition, $type, $pullDeclinedEntries);
// If we're looking for seating rank, return the rank from the list of ranked entries // If we're looking for seating rank, return the rank from the list of ranked entries
if ($type === 'seating') { if ($type === 'seating') {

View File

@ -67,7 +67,12 @@
@endif @endif
<x-table.th spacer_only> <x-table.th spacer_only>
<span class="sr-only">Edit</span> <span class="sr-only">Edit</span>
</x-table.th> </x-table.th>
<x-table.th>
Seat
</x-table.th>
<x-table.th>Rank</x-table.th>
</tr> </tr>
</thead> </thead>
<x-table.body> <x-table.body>
@ -107,7 +112,7 @@
@endif @endif
</x-table.td> </x-table.td>
@endif @endif
<td> </td>
@if($entry->audition->hasFlag('seats_published')) @if($entry->audition->hasFlag('seats_published'))
<td> <td>
@if($entry->seat) @if($entry->seat)
@ -116,6 +121,9 @@
Not Seated Not Seated
@endif @endif
</td> </td>
<td>
{{ $entry->rank('seating', false) }}
</td>
@endif @endif