tournament: use tournamentGameModel instead gameModel
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
from __future__ import annotations
|
||||
from typing import Any
|
||||
|
||||
from games.models import GameModel
|
||||
|
||||
@ -96,10 +97,20 @@ class TournamentGameModel(GameModel):
|
||||
round = models.IntegerField()
|
||||
pos = models.IntegerField()
|
||||
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
from .consumers import tournament_manager
|
||||
self.room = tournament_manager.get(self.tournament)
|
||||
|
||||
|
||||
def start(self):
|
||||
super().start()
|
||||
|
||||
self.room.set_game_as_started(self)
|
||||
|
||||
|
||||
def finish(self, winner_id):
|
||||
super().finish(winner_id)
|
||||
|
||||
from .consumers import tournament_manager
|
||||
|
||||
room = tournament_manager.get(self.tournament)
|
||||
room.set_game_as_finished(self)
|
||||
self.room.set_game_as_finished(self)
|
Reference in New Issue
Block a user