]> git.localhorst.tv Git - alttp.git/commitdiff
fix result protocol
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 1 Dec 2025 14:18:10 +0000 (15:18 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Mon, 1 Dec 2025 14:18:10 +0000 (15:18 +0100)
app/Http/Controllers/ResultController.php

index 563fdd6cf0eb0d36bd6e3912233ba275355e3937..d9ab52c62bac6ff45abd2177e12abe280c489cb4 100644 (file)
@@ -30,14 +30,14 @@ class ResultController extends Controller
                        $this->authorize('create', Result::class);
                }
 
-               $result = Result::firstOrNew([
+               $result = Result::firstOrCreate([
                        'round_id' => $validatedData['round_id'],
                        'user_id' => $validatedData['user_id'],
                ]);
                if (!$round->locked && !$result->verified_at) {
                        if (isset($validatedData['forfeit'])) $result->forfeit = $validatedData['forfeit'];
                        if (isset($validatedData['time'])) $result->time = $validatedData['time'];
-                       if ($result->id && $result->isDirty(['forfeit', 'time'])) {
+                       if (!$result->wasRecentlyCreated && $result->isDirty(['forfeit', 'time'])) {
                                ++$result->changed;
                        }
                }