feat(submissions): scoped submissions per user/matchs, sync from polylan
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from django.tasks import task
|
||||
from games.models import EventGame
|
||||
from submissions.models import ImageCrop, SubmissionFile, OCRStatus
|
||||
from submissions.services.aandt_sync import sync_event_game_scopes
|
||||
|
||||
from PIL import Image
|
||||
import pytesseract
|
||||
@@ -69,3 +71,24 @@ def process_crop(crop_id: str):
|
||||
return
|
||||
|
||||
_process_ocr_file(crop, crop.submission_file.file, crop=crop)
|
||||
|
||||
|
||||
@task
|
||||
def sync_all_event_games_task():
|
||||
"""Queue a Scope sync for every EventGame with an AAndT token configured."""
|
||||
event_games = EventGame.objects.exclude(apibot_token__isnull=True).exclude(
|
||||
apibot_token=""
|
||||
)
|
||||
|
||||
for event_game in event_games:
|
||||
sync_event_game_scopes_task.enqueue(event_game.id)
|
||||
|
||||
|
||||
@task
|
||||
def sync_event_game_scopes_task(event_game_id: int):
|
||||
event_game = EventGame.objects.filter(id=event_game_id).first()
|
||||
|
||||
if not event_game:
|
||||
return
|
||||
|
||||
sync_event_game_scopes(event_game)
|
||||
|
||||
Reference in New Issue
Block a user