EnterScore action working to add a total score when a score is saved by a judge.

This commit is contained in:
Matt Young 2025-06-11 15:41:37 -05:00
parent e6da41d1d9
commit e47265badd
2 changed files with 3 additions and 1 deletions

View File

@ -106,11 +106,12 @@ class EnterScore
'sheet_total' => ($scoreSheetTotal / $maxPossible) * 100, 'sheet_total' => ($scoreSheetTotal / $maxPossible) * 100,
]); ]);
} else { } else {
$finalTotal = ($scoreSheetTotal / $maxPossible) * 100;
$scoreSheet = ScoreSheet::create([ $scoreSheet = ScoreSheet::create([
'user_id' => $user->id, 'user_id' => $user->id,
'entry_id' => $entry->id, 'entry_id' => $entry->id,
'subscores' => $subscoresStorageArray, 'subscores' => $subscoresStorageArray,
'sheet_total' => ($scoreSheetTotal / $maxPossible) * 100, 'sheet_total' => $finalTotal,
]); ]);
} }

View File

@ -13,6 +13,7 @@ class ScoreSheet extends Model
'user_id', 'user_id',
'entry_id', 'entry_id',
'subscores', 'subscores',
'sheet_total',
]; ];
protected $casts = ['subscores' => 'json']; protected $casts = ['subscores' => 'json'];