Skip to content

Commit

Permalink
Make store_game_session set each session team active.
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-jvessella committed Mar 29, 2024
1 parent c35e440 commit 4c2bf78
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion gamebrain/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ async def store_team(
headless_url: Optional[str] | None = "",
team_name: Optional[str] = None,
game_session_id: Optional[int] = None,
active: Optional[bool] = None,
):
"""
ship_gamespace_id: Maximum 36 character string.
Expand All @@ -266,6 +267,8 @@ async def store_team(
kwargs["team_name"] = team_name
if game_session_id:
kwargs["game_session_id"] = game_session_id
if active is not None:
kwargs["active"] = active
team_data = DBManager.TeamData(id=team_id, **kwargs)
await DBManager.merge_rows([team_data])

Expand All @@ -288,7 +291,11 @@ async def store_game_session(
merged_session_data = await DBManager.merge_rows([session_data])

for team_id in team_ids:
await store_team(team_id, game_session_id=merged_session_data[0].id)
await store_team(
team_id,
game_session_id=merged_session_data[0].id,
active=True
)

await store_players(players)

Expand Down

0 comments on commit 4c2bf78

Please sign in to comment.