Initial commit

This commit is contained in:
Zdeněk Burda
2026-01-09 21:26:40 +01:00
parent e83aec6dca
commit 41e3ce6f25
404 changed files with 61250 additions and 28 deletions

View File

@@ -0,0 +1,36 @@
<?php
namespace App\Services\Evaluation;
use App\Models\EvaluationRun;
class ClaimedRunResolver
{
public static function forRound(int $roundId): EvaluationRun
{
// Preferujeme poslední CLAIMED run, aby projekce zůstala konzistentní.
$run = EvaluationRun::where('round_id', $roundId)
->where('rules_version', 'CLAIMED')
->orderByDesc('created_at')
->first();
if ($run) {
return $run;
}
return self::createNewForRound($roundId);
}
public static function createNewForRound(int $roundId, ?int $createdByUserId = null): EvaluationRun
{
// CLAIMED run je projekce deklarovaných výsledků, ne finální vyhodnocení.
return EvaluationRun::create([
'round_id' => $roundId,
'rules_version' => 'CLAIMED',
'name' => 'Deklarované výsledky',
'is_official' => false,
'status' => 'PENDING',
'created_by_user_id' => $createdByUserId,
]);
}
}