diff options
| author | Karan Jayachandra <mail@karanjayachandra.com> | 2025-07-14 20:16:07 +0200 |
|---|---|---|
| committer | Karan Jayachandra <mail@karanjayachandra.com> | 2025-07-14 20:16:07 +0200 |
| commit | b73e8f510f1b3a13d942e1ad42c8a04401eb6b8c (patch) | |
| tree | 26612c20e03adb3cb26c36f36d31576f3c77dc1c /app/utilities.py | |
| parent | 072d546490ba6cd4422cbc9cd6644b455f58fd46 (diff) | |
| parent | 895ed4be433a4159250b276bd99f574c9c39c98e (diff) | |
Merge branch 'develop' into 'main'3.0
Develop
See merge request KaranJayachandra/match_up!17
Diffstat (limited to 'app/utilities.py')
| -rw-r--r-- | app/utilities.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/utilities.py b/app/utilities.py index cd75d2a..d8bd3da 100644 --- a/app/utilities.py +++ b/app/utilities.py @@ -41,7 +41,7 @@ def select_players(players: Sequence[Player], count: int) -> list[Player]: player_identifiers = [] for game in games: for i in range(4): - player_identifiers.append(getattr(game, f"player_{i+1}")) + player_identifiers.append(getattr(game, f"player_{i + 1}")) identifiers = [player.id for player in players] play_count = [player_identifiers.count(player.id) for player in players] ids = sample_list(identifiers, play_count, count) @@ -89,10 +89,11 @@ def separate_teams_and_players( def get_placeholder_games(courts: list[Court], name: str) -> list[DisplayGame]: p = db.session.query(Player).where(Player.first_name == name).first() if p is None: - raise ValueError(f"Database isn't initialized.") - player_data = {"round_id": None} | {f"player_{i+1}": p.id for i in range(4)} + raise ValueError("Database isn't initialized.") + player_data = {"round_id": None} | {f"player_{i + 1}": p.id for i in range(4)} games = [ - DisplayGame(Game(**({"court_id": court.id} | player_data))) for court in courts # type: ignore + DisplayGame(Game(**({"court_id": court.id} | player_data))) # type: ignore + for court in courts ] return games |
