Season 8 Decision Fix

This commit is contained in:
Cal Corum 2024-01-29 00:03:49 -06:00
parent 59094fefe7
commit 183e4bc91e
2 changed files with 17 additions and 4 deletions

View File

@ -73,8 +73,15 @@ async def get_decisions(
# all_players = Player.select().where(Player.team_id << team_id)
# all_dec = all_dec.where(Decision.pitcher << all_players)
if team_id is not None:
all_teams = Team.select().where(Team.id << team_id)
all_dec = all_dec.where(Decision.team << all_teams)
s8_teams = [int(x) for x in team_id if int(x) <= 350]
if season is not None and 8 in season or s8_teams:
all_teams = Team.select().where(Team.id << team_id)
all_games = StratGame.select().where(
(StratGame.away_team << all_teams) | (StratGame.home_team << all_teams))
all_dec = all_dec.where(Decision.game << all_games)
else:
all_teams = Team.select().where(Team.id << team_id)
all_dec = all_dec.where(Decision.team << all_teams)
if s_type is not None:
all_games = StratGame.select().where(StratGame.season_type == s_type)
all_dec = all_dec.where(Decision.game << all_games)

View File

@ -639,7 +639,13 @@ async def get_pitching_totals(
if team_id is not None:
all_teams = Team.select().where(Team.id << team_id)
pit_plays = pit_plays.where(StratPlay.pitcher_team << all_teams)
all_dec = all_dec.where(Decision.team << all_teams)
s8_teams = [x for x in team_id if int(x) <= 350]
if s8_teams:
all_games = StratGame.select().where(
(StratGame.away_team << all_teams) | (StratGame.home_team << all_teams))
all_dec = all_dec.where(Decision.game << all_games)
else:
all_dec = all_dec.where(Decision.team << all_teams)
if obc is not None:
pit_plays = pit_plays.where(StratPlay.on_base_code << obc)
@ -793,7 +799,7 @@ async def get_pitching_totals(
'lob_2outs': x.count_lo1_3out + x.count_lo2_3out + x.count_lo3_3out,
'rbi%': rbi_rate,
'week': this_week,
're24_primary': x.sum_repri * -1
're24_primary': x.sum_repri * -1 if x.sum_repri is not None else None
})
db.close()
if csv: