From 11568a2d2e7b76098fe240768583a36b84e4a5cc Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sat, 27 Apr 2024 08:50:33 -0500 Subject: [PATCH] Fix pitcher decisions across game_types --- app/routers_v2/stratplays.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/routers_v2/stratplays.py b/app/routers_v2/stratplays.py index 66b2aca..e64f19a 100644 --- a/app/routers_v2/stratplays.py +++ b/app/routers_v2/stratplays.py @@ -770,6 +770,10 @@ async def get_pitching_totals( for x in pit_plays: this_dec = all_dec.where(Decision.pitcher == x.pitcher) + if game_type is not None: + all_types = [x.lower() for x in game_type] + all_games = StratGame.select().where(fn.Lower(StratGame.game_type) << all_types) + this_dec = this_dec.where(Decision.game << all_games) tot_outs = x.sum_outs if x.sum_outs > 0 else 1 obp = (x.sum_hit + x.sum_bb + x.sum_hbp + x.sum_ibb) / x.sum_pa slg = (x.sum_hr * 4 + x.sum_triple * 3 + x.sum_double * 2 +