Update stratplay.py
Fix SB stats in playergame group_by
This commit is contained in:
parent
d8ef59dae0
commit
bc37568c8e
@ -399,8 +399,10 @@ async def get_batting_totals(
|
|||||||
bat_plays = bat_plays.order_by(SQL('sum_pa').asc())
|
bat_plays = bat_plays.order_by(SQL('sum_pa').asc())
|
||||||
elif sort == 'newest':
|
elif sort == 'newest':
|
||||||
bat_plays = bat_plays.order_by(StratPlay.game_id.desc(), StratPlay.play_num.desc())
|
bat_plays = bat_plays.order_by(StratPlay.game_id.desc(), StratPlay.play_num.desc())
|
||||||
|
run_plays = run_plays.order_by(StratPlay.game_id.desc(), StratPlay.play_num.desc())
|
||||||
elif sort == 'oldest':
|
elif sort == 'oldest':
|
||||||
bat_plays = bat_plays.order_by(StratPlay.game_id, StratPlay.play_num)
|
bat_plays = bat_plays.order_by(StratPlay.game_id, StratPlay.play_num)
|
||||||
|
run_plays = run_plays.order_by(StratPlay.game_id, StratPlay.play_num)
|
||||||
if limit is not None:
|
if limit is not None:
|
||||||
if limit < 1:
|
if limit < 1:
|
||||||
limit = 1
|
limit = 1
|
||||||
@ -415,7 +417,12 @@ async def get_batting_totals(
|
|||||||
}
|
}
|
||||||
|
|
||||||
for x in bat_plays:
|
for x in bat_plays:
|
||||||
this_run = run_plays.where(StratPlay.runner == x.batter)
|
this_run = run_plays.order_by(StratPlay.id)
|
||||||
|
if 'player' in group_by:
|
||||||
|
this_run = this_run.where(StratPlay.runner == x.batter)
|
||||||
|
if 'game' in group_by:
|
||||||
|
this_run = this_run.where(StratPlay.game == x.game)
|
||||||
|
|
||||||
if this_run.count() > 0:
|
if this_run.count() > 0:
|
||||||
sum_sb = this_run[0].sum_sb
|
sum_sb = this_run[0].sum_sb
|
||||||
sum_cs = this_run[0].sum_cs
|
sum_cs = this_run[0].sum_cs
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user