Fix pitcher decisions across game_types

This commit is contained in:
Cal Corum 2024-04-27 08:50:33 -05:00
parent b9a64e8333
commit 11568a2d2e

View File

@ -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 +