Improve alias naming
This commit is contained in:
parent
c5b546d0ed
commit
df73e49406
@ -596,20 +596,20 @@ class Team(BaseModel):
|
|||||||
|
|
||||||
runs_scored, runs_allowed = 0, 0
|
runs_scored, runs_allowed = 0, 0
|
||||||
away_games = StratGame.select(
|
away_games = StratGame.select(
|
||||||
StratGame.away_team, fn.SUM(StratGame.away_score).alias('r_us'),
|
StratGame.away_team, fn.SUM(StratGame.away_score).alias('r_scored'),
|
||||||
fn.SUM(StratGame.home_score).alias('r_them')
|
fn.SUM(StratGame.home_score).alias('r_allowed')
|
||||||
).where((StratGame.away_team == self) & StratGame.game_num.is_null(False))
|
).where((StratGame.away_team == self) & StratGame.game_num.is_null(False))
|
||||||
if away_games.count() > 0:
|
if away_games.count() > 0:
|
||||||
runs_scored += away_games[0].r_us
|
runs_scored += away_games[0].r_scored
|
||||||
runs_allowed += away_games[0].r_them
|
runs_allowed += away_games[0].r_allowed
|
||||||
|
|
||||||
home_games = StratGame.select(
|
home_games = StratGame.select(
|
||||||
StratGame.home_team, fn.SUM(StratGame.home_score).alias('r_us'),
|
StratGame.home_team, fn.SUM(StratGame.home_score).alias('r_scored'),
|
||||||
fn.SUM(StratGame.away_score).alias('r_them')
|
fn.SUM(StratGame.away_score).alias('r_allowed')
|
||||||
).where((StratGame.home_team == self) & StratGame.game_num.is_null(False))
|
).where((StratGame.home_team == self) & StratGame.game_num.is_null(False))
|
||||||
if home_games.count() > 0:
|
if home_games.count() > 0:
|
||||||
runs_scored += home_games[0].r_us
|
runs_scored += home_games[0].r_scored
|
||||||
runs_allowed += home_games[0].r_them
|
runs_allowed += home_games[0].r_allowed
|
||||||
|
|
||||||
if runs_allowed == 0:
|
if runs_allowed == 0:
|
||||||
pythag_win_pct = 1
|
pythag_win_pct = 1
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user