Cache scores after calculating
This commit is contained in:
parent
0ab7d70612
commit
8f7a333898
|
|
@ -6,6 +6,7 @@ namespace App\Actions\Tabulation;
|
||||||
|
|
||||||
use App\Exceptions\TabulationException;
|
use App\Exceptions\TabulationException;
|
||||||
use App\Models\BonusScore;
|
use App\Models\BonusScore;
|
||||||
|
use App\Models\CalculatedScore;
|
||||||
use App\Models\Entry;
|
use App\Models\Entry;
|
||||||
use App\Services\AuditionService;
|
use App\Services\AuditionService;
|
||||||
use App\Services\EntryService;
|
use App\Services\EntryService;
|
||||||
|
|
@ -42,8 +43,15 @@ class AllowForOlympicScoring implements CalculateEntryScore
|
||||||
$this->isEntryANoShow($entry);
|
$this->isEntryANoShow($entry);
|
||||||
$this->areAllJudgesIn($entry);
|
$this->areAllJudgesIn($entry);
|
||||||
$this->areAllJudgesValid($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);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class CalculatedScore extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected $guarded = [];
|
||||||
|
|
||||||
|
protected $casts = ['calculatedScore' => 'json'];
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Entry;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('calculated_scores', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue