From: Daniel Karbach Date: Fri, 28 Nov 2025 19:46:58 +0000 (+0100) Subject: periodically retrofit seed downloads X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=bfa11312b941043f4cbba014b93ee5f44c3b5b26;p=alttp.git periodically retrofit seed downloads --- 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();