From f3013670a346b01da61785ec39987ac9feaca1ad Mon Sep 17 00:00:00 2001 From: Matt Young Date: Sun, 22 Jun 2025 23:38:35 -0500 Subject: [PATCH] Correct error in doubler class. Add artisan command to sync doublers. --- app/Console/Commands/SyncDoublers.php | 39 +++++++++++++++++++++++++++ app/Models/Doubler.php | 1 + 2 files changed, 40 insertions(+) create mode 100644 app/Console/Commands/SyncDoublers.php diff --git a/app/Console/Commands/SyncDoublers.php b/app/Console/Commands/SyncDoublers.php new file mode 100644 index 0000000..d50235f --- /dev/null +++ b/app/Console/Commands/SyncDoublers.php @@ -0,0 +1,39 @@ +argument('event')) { + $event = Event::findOrFail($eventId); + Doubler::syncForEvent($event); + $this->info("Synced doublers for event {$event->name}"); + } else { + Doubler::syncDoublers(); + $this->info('Synced doublers for all events'); + } + } +} diff --git a/app/Models/Doubler.php b/app/Models/Doubler.php index e0714bb..907aca3 100644 --- a/app/Models/Doubler.php +++ b/app/Models/Doubler.php @@ -69,6 +69,7 @@ class Doubler extends Model ], [ 'accepted_entry' => $acceptedEntryId, + 'entry_count' => $student->entriesForEvent($eventId)->count(), ] ); }