feat(submissions): sync scopes admin from token
This commit is contained in:
@@ -5,7 +5,7 @@ from django_object_actions import (
|
||||
takes_instance_or_queryset,
|
||||
)
|
||||
|
||||
from submissions.tasks import sync_event_game_scopes_task
|
||||
from submissions.tasks import schedule_scope_sync
|
||||
|
||||
from .models import EventGame, Game
|
||||
from .tasks import refresh_steam_games_task
|
||||
@@ -67,11 +67,12 @@ class EventGameAdmin(DjangoObjectActions, admin.ModelAdmin):
|
||||
tokened = queryset.exclude(apibot_token__isnull=True).exclude(apibot_token="")
|
||||
skipped = queryset.count() - tokened.count()
|
||||
|
||||
for event_game in tokened:
|
||||
sync_event_game_scopes_task.enqueue(event_game.id)
|
||||
started = sum(schedule_scope_sync(event_game.id) for event_game in tokened)
|
||||
|
||||
self.message_user(
|
||||
request, f"Queued scope sync for {tokened.count()} EventGame(s)."
|
||||
request,
|
||||
f"Started scope sync for {started} EventGame(s)"
|
||||
f" ({tokened.count() - started} already running).",
|
||||
)
|
||||
if skipped:
|
||||
self.message_user(
|
||||
|
||||
Reference in New Issue
Block a user