Add gauntlet_id to /games

This commit is contained in:
Cal Corum 2024-05-13 15:36:34 -05:00
parent e4d2e432dd
commit aca7d6df23

View File

@ -46,7 +46,8 @@ async def get_games(
season: list = Query(default=None), forfeit: Optional[bool] = None, away_team_id: list = Query(default=None),
home_team_id: list = Query(default=None), team1_id: list = Query(default=None),
team2_id: list = Query(default=None), game_type: list = Query(default=None), ranked: Optional[bool] = None,
short_game: Optional[bool] = None, csv: Optional[bool] = False, short_output: bool = False):
short_game: Optional[bool] = None, csv: Optional[bool] = False, short_output: bool = False,
gauntlet_id: Optional[int] = None):
all_games = StratGame.select()
if season is not None:
@ -72,6 +73,8 @@ async def get_games(
all_games = all_games.where(StratGame.ranked == ranked)
if short_game is not None:
all_games = all_games.where(StratGame.short_game == short_game)
if gauntlet_id is not None:
all_games = all_games.where(StratGame.game_type.contains(f'gauntlet-{gauntlet_id}'))
if csv:
return_vals = [model_to_dict(x) for x in all_games]