From bfa11312b941043f4cbba014b93ee5f44c3b5b26 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Fri, 28 Nov 2025 20:46:58 +0100 Subject: [PATCH] periodically retrofit seed downloads --- app/Console/Commands/RoundSeedCleanup.php | 48 +++++++++++++++++++++++ routes/console.php | 1 + 2 files changed, 49 insertions(+) create mode 100644 app/Console/Commands/RoundSeedCleanup.php diff --git a/app/Console/Commands/RoundSeedCleanup.php b/app/Console/Commands/RoundSeedCleanup.php new file mode 100644 index 0000000..5d5ba27 --- /dev/null +++ b/app/Console/Commands/RoundSeedCleanup.php @@ -0,0 +1,48 @@ +where('locked', '=', '0')->get(); + foreach ($rounds as $round) { + $missing = $round->results()->whereNull('got_seed_at')->get(); + foreach ($missing as $result) { + $entry = $round->protocols() + ->where('user_id', '=', $result->user_id) + ->where('type', '=', 'round.getseed') + ->oldest() + ->first(); + if ($entry) { + $result->got_seed_at = $entry->created_at; + $result->save(); + ResultChanged::dispatch($result); + } + } + } + return 0; + } +} diff --git a/routes/console.php b/routes/console.php index d2ce7c0..9aa4c99 100644 --- a/routes/console.php +++ b/routes/console.php @@ -46,3 +46,4 @@ Schedule::command('discord:episode-subscriptions')->everyMinute(); Schedule::command('chat:evaluate 100')->everyMinute()->runInBackground(); Schedule::command('guessing:clean')->everyFifteenMinutes(); +Schedule::command('round:seed-cleanup')->everyFifteenMinutes(); -- 2.47.3