diff --git a/app/Actions/Tabulation/AllowForOlympicScoring.php b/app/Actions/Tabulation/AllowForOlympicScoring.php index 258b8bb..483088b 100644 --- a/app/Actions/Tabulation/AllowForOlympicScoring.php +++ b/app/Actions/Tabulation/AllowForOlympicScoring.php @@ -6,6 +6,7 @@ namespace App\Actions\Tabulation; use App\Exceptions\TabulationException; use App\Models\BonusScore; +use App\Models\CalculatedScore; use App\Models\Entry; use App\Services\AuditionService; use App\Services\EntryService; @@ -42,8 +43,15 @@ class AllowForOlympicScoring implements CalculateEntryScore $this->isEntryANoShow($entry); $this->areAllJudgesIn($entry); $this->areAllJudgesValid($entry); + $calculatedScores = $this->getJudgeTotals($mode, $entry); + CalculatedScore::create([ + 'entry_id' => $entry->id, + 'mode' => $mode, + 'calculatedScore' => $calculatedScores, + ]); - return $this->getJudgeTotals($mode, $entry); + return $calculatedScores; + // return $this->getJudgeTotals($mode, $entry); }); } diff --git a/app/Models/CalculatedScore.php b/app/Models/CalculatedScore.php new file mode 100644 index 0000000..f514d8d --- /dev/null +++ b/app/Models/CalculatedScore.php @@ -0,0 +1,15 @@ + 'json']; +} diff --git a/database/migrations/2024_10_31_120759_create_calculated_scores_table.php b/database/migrations/2024_10_31_120759_create_calculated_scores_table.php new file mode 100644 index 0000000..63d0be7 --- /dev/null +++ b/database/migrations/2024_10_31_120759_create_calculated_scores_table.php @@ -0,0 +1,31 @@ +id(); + $table->foreignIdFor(Entry::class)->constrained()->cascadeOnDelete()->cascadeOnUpdate(); + $table->string('mode'); + $table->json('calculatedScore'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('calculated_scores'); + } +};