Update stratplay.py
Fixed catcher stats in /fielding
This commit is contained in:
parent
4e21e42b6d
commit
ffb70f1633
@ -1,3 +1,4 @@
|
|||||||
|
import copy
|
||||||
from itertools import groupby
|
from itertools import groupby
|
||||||
from tokenize import group
|
from tokenize import group
|
||||||
|
|
||||||
@ -1000,14 +1001,24 @@ async def get_fielding_totals(
|
|||||||
# sum_error = x.sum_error
|
# sum_error = x.sum_error
|
||||||
|
|
||||||
this_pos = 'TOT'
|
this_pos = 'TOT'
|
||||||
this_cat = StratPlay.select().where(StratPlay.play_num < 0)
|
|
||||||
if 'position' in group_by:
|
if 'position' in group_by:
|
||||||
this_pos = x.check_pos
|
this_pos = x.check_pos
|
||||||
if this_pos == 'C' and 'player' in group_by:
|
|
||||||
if 'player' in group_by:
|
this_cat = cat_plays.order_by(StratPlay.id)
|
||||||
this_cat = cat_plays.where(StratPlay.catcher == x.defender)
|
if group_by in ['player', 'playerposition']:
|
||||||
if 'game' in group_by:
|
this_cat = this_cat.where(StratPlay.catcher == x.defender)
|
||||||
this_cat = cat_plays.where(StratPlay.game == x.game)
|
elif group_by in ['team', 'teamposition']:
|
||||||
|
this_cat = this_cat.where(StratPlay.catcher_team == x.defender_team)
|
||||||
|
elif group_by in ['playerteam', 'playerteamposition']:
|
||||||
|
this_cat = this_cat.where((StratPlay.catcher == x.defender) & (StratPlay.catcher_team == x.defender_team))
|
||||||
|
elif group_by in ['playergame', 'playerpositiongame']:
|
||||||
|
this_cat = this_cat.where((StratPlay.catcher == x.defender) & (StratPlay.game == x.game))
|
||||||
|
elif group_by == 'playerweek':
|
||||||
|
this_cat = this_cat.where((StratPlay.catcher == x.defender) & (StratPlay.game.week == x.game.week))
|
||||||
|
elif group_by == 'teamweek':
|
||||||
|
this_cat = this_cat.where((StratPlay.catcher_team == x.defender_team) & (StratPlay.game.week == x.game.week))
|
||||||
|
|
||||||
|
this_cat = this_cat.where(StratPlay.game == x.game)
|
||||||
|
|
||||||
if this_cat.count() > 0:
|
if this_cat.count() > 0:
|
||||||
sum_sb = this_cat[0].sum_sb
|
sum_sb = this_cat[0].sum_sb
|
||||||
@ -1022,9 +1033,9 @@ async def get_fielding_totals(
|
|||||||
sum_pb = 0
|
sum_pb = 0
|
||||||
sum_error = x.sum_error
|
sum_error = x.sum_error
|
||||||
|
|
||||||
this_player = x.defender_id if short_output else model_to_dict(x.defender, recurse=False)
|
this_player = 'TOT'
|
||||||
if group_by == 'teamposition':
|
if 'player' in group_by:
|
||||||
this_player = 'TOT'
|
this_player = x.defender_id if short_output else model_to_dict(x.defender, recurse=False)
|
||||||
|
|
||||||
this_game = 'TOT'
|
this_game = 'TOT'
|
||||||
if 'game' in group_by:
|
if 'game' in group_by:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user