game: core: use server game calulation form

This commit is contained in:
2024-01-17 14:23:23 +01:00
parent b2dc43c1d8
commit 2bd0624100
15 changed files with 274 additions and 110 deletions

View File

@ -0,0 +1,22 @@
from .Game import Game
from ..models import GameModel
class GameManager():
def __init__(self) -> None:
self._game_list: [Game] = []
def get(self, game_id: int):
if (not GameModel.objects.filter(pk = game_id, started = True, finished = False).exists()):
return None
for game in self._game_list:
game: Game
if (game.game_id == game_id):
return game
return Game(game_id)