feat(submissions): auto-replace player in scopes, cancel sync + info about the sync

This commit is contained in:
2026-10-16 01:49:53 +02:00
parent de5ee8ae7a
commit 13c09adff3
18 changed files with 1051 additions and 137 deletions
+13 -3
View File
@@ -5,7 +5,7 @@ from django_object_actions import (
takes_instance_or_queryset,
)
from submissions.tasks import schedule_scope_sync
from submissions.tasks import schedule_scope_sync, stop_scope_sync
from .models import EventGame, Game
from .tasks import refresh_steam_games_task
@@ -51,8 +51,8 @@ class EventGameAdmin(DjangoObjectActions, admin.ModelAdmin):
list_display = ["game", "event", "enabled", "has_apibot_token"]
list_filter = ["event", "enabled"]
search_fields = ["game__name", "event__name"]
actions = ["sync_scopes"]
change_actions = ["sync_scopes"]
actions = ["sync_scopes", "stop_scope_sync"]
change_actions = ["sync_scopes", "stop_scope_sync"]
@admin.display(description="AAndT token", boolean=True)
def has_apibot_token(self, obj):
@@ -80,3 +80,13 @@ class EventGameAdmin(DjangoObjectActions, admin.ModelAdmin):
f"Skipped {skipped} EventGame(s) with no AAndT token configured.",
level=messages.WARNING,
)
@action(
label="Stop scope sync",
description="Stop the scope sync loop of selected EventGames",
)
@takes_instance_or_queryset
def stop_scope_sync(self, request, queryset):
stopped = sum(stop_scope_sync(event_game.id) for event_game in queryset)
self.message_user(request, f"Stopped scope sync for {stopped} EventGame(s).")