Fix by where no-shows would block seating.

This commit is contained in:
Matt Young 2024-10-24 20:04:59 -05:00
parent 929619e817
commit bed3e13e01
4 changed files with 27 additions and 1 deletions

View File

@ -31,6 +31,7 @@ class AllJudgesCount implements CalculateEntryScore
$cacheKey = 'entryScore-'.$entry->id.'-'.$mode;
return Cache::remember($cacheKey, 10, function () use ($mode, $entry) {
$this->isEntryANoShow($entry);
$this->basicValidation($mode, $entry);
$this->areAllJudgesIn($entry);
$this->areAllJudgesValid($entry);
@ -88,4 +89,11 @@ class AllJudgesCount implements CalculateEntryScore
throw new TabulationException('Score exists from a judge not assigned to this audition');
}
}
protected function isEntryANoShow(Entry $entry): void
{
if ($entry->hasFlag('no_show')) {
throw new TabulationException('No Show');
}
}
}

View File

@ -39,6 +39,7 @@ class AllowForOlympicScoring implements CalculateEntryScore
return Cache::remember($cacheKey, 10, function () use ($mode, $entry) {
$this->basicValidation($mode, $entry);
$this->isEntryANoShow($entry);
$this->areAllJudgesIn($entry);
$this->areAllJudgesValid($entry);
@ -134,4 +135,11 @@ class AllowForOlympicScoring implements CalculateEntryScore
throw new TabulationException('Score exists from a judge not assigned to this audition');
}
}
protected function isEntryANoShow(Entry $entry): void
{
if ($entry->hasFlag('no_show')) {
throw new TabulationException('No Show');
}
}
}

View File

@ -8,6 +8,7 @@ use App\Exceptions\TabulationException;
use App\Models\Audition;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\Cache;
use function is_numeric;
class RankAuditionEntries
@ -29,6 +30,12 @@ class RankAuditionEntries
}
/**
* For a given audition, return a collection of entries ranked by total score. Each entry will have a
* property rank that either is their rank or a flag reflecting no-show, declined, or failed-prelim status
*
* @throws TabulationException
*/
public function calculateRank(string $mode, Audition $audition): Collection
{
$this->basicValidation($mode, $audition);
@ -80,7 +87,6 @@ class RankAuditionEntries
return $entries;
}
protected function basicValidation($mode, Audition $audition): void
{
if ($mode !== 'seating' && $mode !== 'advancement') {

View File

@ -62,6 +62,10 @@ class SeatAuditionFormController extends Controller
$totalScoreColumn = $entry->score_totals[0] >= 0 ? $entry->score_totals[0] : $entry->score_message;
$fullyScored = $entry->score_totals[0] >= 0;
}
// No Shows are fully scored
if ($entry->hasFlag('no_show')) {
$fullyScored = true;
}
$doublerData = $this->doublerService->entryDoublerData($entry);
$entryData[] = [
'rank' => $entry->rank,