31 lines
773 B
PHP
31 lines
773 B
PHP
<?php
|
|
|
|
namespace App\Actions\Tabulation;
|
|
|
|
use App\Models\Audition;
|
|
use App\Models\Entry;
|
|
use Debugbar;
|
|
|
|
class CalculateAuditionScores
|
|
{
|
|
public function __construct()
|
|
{
|
|
|
|
}
|
|
|
|
public function __invoke(Audition $audition): void
|
|
{
|
|
$totaler = app(TotalEntryScores::class);
|
|
$scores_required = $audition->judges->count();
|
|
$pending_entries = Entry::where('audition_id', $audition->id)
|
|
->has('scoreSheets', '=', $scores_required)
|
|
->whereDoesntHave('totalScore')
|
|
->with('audition.scoringGuide.subscores')
|
|
->get();
|
|
foreach ($pending_entries as $entry) {
|
|
Debugbar::debug('Calculating scores for entry: '.$entry->id);
|
|
$totaler->__invoke($entry);
|
|
}
|
|
}
|
|
}
|