Fixed issue with results output
This commit is contained in:
parent
3208b31524
commit
165d2c9f6c
|
|
@ -33,7 +33,7 @@ class GetExportData
|
|||
foreach ($events as $event) {
|
||||
$auditions = $event->auditions;
|
||||
foreach ($auditions as $audition) {
|
||||
$entries = $ranker->rank('seating', $audition);
|
||||
$entries = $ranker($audition, 'seating');
|
||||
foreach ($entries as $entry) {
|
||||
$thisRow = $audition->name.',';
|
||||
$thisRow .= $entry->raw_rank ?? '';
|
||||
|
|
@ -41,7 +41,7 @@ class GetExportData
|
|||
$thisRow .= $entry->student->full_name().',';
|
||||
$thisRow .= $entry->student->school->name.',';
|
||||
$thisRow .= $entry->student->grade.',';
|
||||
$thisRow .= $entry->score_totals[0] ?? '';
|
||||
$thisRow .= $entry->totalScore->seating_total ?? '';
|
||||
$thisRow .= ',';
|
||||
if ($entry->hasFlag('failed_prelim')) {
|
||||
$thisRow .= 'Failed Prelim';
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class RankAuditionEntries
|
|||
*
|
||||
* @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') {
|
||||
throw new AuditionAdminException('Invalid rank type (must be seating or advancement)');
|
||||
|
|
@ -33,8 +33,8 @@ class RankAuditionEntries
|
|||
$cache_duration = 15;
|
||||
|
||||
if ($rank_type === 'seating') {
|
||||
return cache()->remember('rank_seating_'.$audition->id, $cache_duration, function () use ($audition) {
|
||||
return $this->get_seating_ranks($audition);
|
||||
return cache()->remember('rank_seating_'.$audition->id, $cache_duration, function () use ($audition, $pullDeclinedEntries) {
|
||||
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) {
|
||||
$totalColumn = 'seating_total_with_bonus';
|
||||
|
|
@ -74,7 +74,7 @@ class RankAuditionEntries
|
|||
|
||||
$rankOn = 1;
|
||||
foreach ($sortedEntries as $entry) {
|
||||
if ($entry->hasFlag('declined')) {
|
||||
if ($entry->hasFlag('declined') && $pullDeclinedEntries) {
|
||||
$entry->seatingRank = 'declined';
|
||||
} else {
|
||||
$entry->seatingRank = $rankOn;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ class Entry extends Model
|
|||
/**
|
||||
* @throws AuditionAdminException
|
||||
*/
|
||||
public function rank(string $type)
|
||||
public function rank(string $type, bool $pullDeclinedEntries = true)
|
||||
{
|
||||
$ranker = app(RankAuditionEntries::class);
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ class Entry extends Model
|
|||
}
|
||||
|
||||
// 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 ($type === 'seating') {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,12 @@
|
|||
@endif
|
||||
<x-table.th spacer_only>
|
||||
<span class="sr-only">Edit</span>
|
||||
|
||||
</x-table.th>
|
||||
<x-table.th>
|
||||
Seat
|
||||
</x-table.th>
|
||||
<x-table.th>Rank</x-table.th>
|
||||
</tr>
|
||||
</thead>
|
||||
<x-table.body>
|
||||
|
|
@ -107,7 +112,7 @@
|
|||
@endif
|
||||
</x-table.td>
|
||||
@endif
|
||||
|
||||
<td> </td>
|
||||
@if($entry->audition->hasFlag('seats_published'))
|
||||
<td>
|
||||
@if($entry->seat)
|
||||
|
|
@ -116,6 +121,9 @@
|
|||
Not Seated
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{ $entry->rank('seating', false) }}
|
||||
</td>
|
||||
@endif
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue