tournament: game: finish event

This commit is contained in:
2024-04-25 15:44:09 +02:00
parent 02bbaa6d9f
commit dbb8e07d7d
9 changed files with 135 additions and 64 deletions

View File

@ -6,6 +6,8 @@ from .ASpectator import ASpectator
from ..models import GameModel
from tournament.models import TournamentGameModel
from django.contrib.auth.models import User
class AGame(AbstractRoom):
@ -16,7 +18,11 @@ class AGame(AbstractRoom):
self.game_manager = game_manager
self.model: GameModel = GameModel.objects.get(pk = game_id, game_type = game_type)
query = TournamentGameModel.objects.filter(pk = game_id, game_type = game_type)
if (query.exists()):
self.model: TournamentGameModel | GameModel = query[0]
else:
self.model: TournamentGameModel | GameModel = GameModel.objects.get(pk = game_id, game_type = game_type)
players: list[User] = self.model.get_players()