diff options
| author | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-10-16 23:28:46 +0200 |
|---|---|---|
| committer | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-10-16 23:28:46 +0200 |
| commit | 156056e9c31468564fb53ca284996a5de41471fb (patch) | |
| tree | d7cf9efc12e0fb411de3f9b33ac2f478cb29133b /controller.py | |
| parent | 74480cbe2b335fd141cdf5f07bb08808c0d08692 (diff) | |
Working version with all functionality
Diffstat (limited to 'controller.py')
| -rw-r--r-- | controller.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/controller.py b/controller.py index 1116443..2e09e9f 100644 --- a/controller.py +++ b/controller.py @@ -2,7 +2,7 @@ from typing import Tuple from operator import attrgetter from dataclasses import dataclass from utilities import sample_list -from model import Team, Game, PlayerList, CourtList, MAX_LEVEL, PLAYER_PER_COURT +from model import Team, Game, PlayerList, CourtList, Timer, MAX_LEVEL, PLAYER_PER_COURT def _create_placeholders(courts: dict, name: str) -> list[Game]: @@ -49,6 +49,7 @@ class RoundGenerator: proposal: tuple = tuple() def __post_init__(self) -> None: + self.timer = Timer() self.history = {key: 0 for key, _ in self.players.get_players().items()} self.games = self._generate_proposal(MAX_LEVEL)[0] @@ -110,7 +111,9 @@ class RoundGenerator: return self.games self.games = proposed_games for player_id in proposed_players: - self.history[player_id] = self.history[player_id] + 1 + if player_id < self.players.guest_id_start: + self.history[player_id] = self.history[player_id] + 1 self.proposal = tuple() self.round += 1 + self.timer.start() return self.games |
