add game_id param to decisions

This commit is contained in:
Cal Corum 2023-07-31 23:02:13 -05:00
parent 147b77b851
commit 302d3fe3ac
2 changed files with 4 additions and 2 deletions

View File

@ -48,7 +48,7 @@ async def get_decisions(
week_start: Optional[int] = None, week_end: Optional[int] = None, win: Optional[int] = None,
loss: Optional[int] = None, hold: Optional[int] = None, save: Optional[int] = None,
b_save: Optional[int] = None, irunners: list = Query(default=None), irunners_scored: list = Query(default=None),
short_output: Optional[bool] = False):
game_id: list = Query(default=None), short_output: Optional[bool] = False):
all_dec = Decision.select()
if season is not None:
@ -57,6 +57,8 @@ async def get_decisions(
all_dec = all_dec.where(Decision.week << week)
if game_num is not None:
all_dec = all_dec.where(Decision.game_num << game_num)
if game_id is not None:
all_dec = all_dec.where(Decision.game_id << game_id)
if season_type is not None:
all_games = StratGame.select().where(StratGame.season_type == season_type)
all_dec = all_dec.where(Decision.game << all_games)

View File

@ -84,7 +84,7 @@ async def get_games(
(StratGame.away_manager_id << manager2_id) | (StratGame.home_manager_id << manager2_id)
)
if played is not None:
all_games = all_games.where(StratGame.game_num.is_null(played))
all_games = all_games.where(StratGame.game_num.is_null(not played))
if game_num is not None:
all_games = all_games.where(StratGame.game_num << game_num)