feat(submissions): sync scopes admin from token

This commit is contained in:
2026-10-16 01:34:56 +02:00
parent 8daa91d6c5
commit de5ee8ae7a
13 changed files with 480 additions and 40 deletions
+5 -4
View File
@@ -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(