Season 8 Decision Fix
This commit is contained in:
parent
59094fefe7
commit
183e4bc91e
@ -73,6 +73,13 @@ async def get_decisions(
|
|||||||
# all_players = Player.select().where(Player.team_id << team_id)
|
# all_players = Player.select().where(Player.team_id << team_id)
|
||||||
# all_dec = all_dec.where(Decision.pitcher << all_players)
|
# all_dec = all_dec.where(Decision.pitcher << all_players)
|
||||||
if team_id is not None:
|
if team_id is not None:
|
||||||
|
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_teams = Team.select().where(Team.id << team_id)
|
||||||
all_dec = all_dec.where(Decision.team << all_teams)
|
all_dec = all_dec.where(Decision.team << all_teams)
|
||||||
if s_type is not None:
|
if s_type is not None:
|
||||||
|
|||||||
@ -639,6 +639,12 @@ async def get_pitching_totals(
|
|||||||
if team_id is not None:
|
if team_id is not None:
|
||||||
all_teams = Team.select().where(Team.id << team_id)
|
all_teams = Team.select().where(Team.id << team_id)
|
||||||
pit_plays = pit_plays.where(StratPlay.pitcher_team << all_teams)
|
pit_plays = pit_plays.where(StratPlay.pitcher_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)
|
all_dec = all_dec.where(Decision.team << all_teams)
|
||||||
|
|
||||||
if obc is not None:
|
if obc is not None:
|
||||||
@ -793,7 +799,7 @@ async def get_pitching_totals(
|
|||||||
'lob_2outs': x.count_lo1_3out + x.count_lo2_3out + x.count_lo3_3out,
|
'lob_2outs': x.count_lo1_3out + x.count_lo2_3out + x.count_lo3_3out,
|
||||||
'rbi%': rbi_rate,
|
'rbi%': rbi_rate,
|
||||||
'week': this_week,
|
'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()
|
db.close()
|
||||||
if csv:
|
if csv:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user