feat(submissions): sync scopes admin from token
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from games.models import EventGame
|
||||
from submissions.tasks import sync_all_event_games_task, sync_event_game_scopes_task
|
||||
from submissions.tasks import schedule_scope_sync, sync_all_event_games_task
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
@@ -25,10 +25,16 @@ class Command(BaseCommand):
|
||||
if not EventGame.objects.filter(id=event_game_id).exists():
|
||||
raise CommandError(f"No EventGame with id={event_game_id}")
|
||||
|
||||
sync_event_game_scopes_task.enqueue(event_game_id)
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(f"Queued sync for EventGame {event_game_id}")
|
||||
)
|
||||
if schedule_scope_sync(event_game_id):
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(f"Started sync for EventGame {event_game_id}")
|
||||
)
|
||||
else:
|
||||
self.stdout.write(
|
||||
self.style.WARNING(
|
||||
f"Sync already running for EventGame {event_game_id}"
|
||||
)
|
||||
)
|
||||
return
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user