From df73e494061004d5ade2ee3fef565d9953127dbc Mon Sep 17 00:00:00 2001 From: Peter Date: Sat, 16 Nov 2024 09:12:30 -0600 Subject: [PATCH] Improve alias naming --- app/db_engine.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/db_engine.py b/app/db_engine.py index 807e7aa..ad6b32a 100644 --- a/app/db_engine.py +++ b/app/db_engine.py @@ -596,20 +596,20 @@ class Team(BaseModel): runs_scored, runs_allowed = 0, 0 away_games = StratGame.select( - StratGame.away_team, fn.SUM(StratGame.away_score).alias('r_us'), - fn.SUM(StratGame.home_score).alias('r_them') + StratGame.away_team, fn.SUM(StratGame.away_score).alias('r_scored'), + fn.SUM(StratGame.home_score).alias('r_allowed') ).where((StratGame.away_team == self) & StratGame.game_num.is_null(False)) if away_games.count() > 0: - runs_scored += away_games[0].r_us - runs_allowed += away_games[0].r_them + runs_scored += away_games[0].r_scored + runs_allowed += away_games[0].r_allowed home_games = StratGame.select( - StratGame.home_team, fn.SUM(StratGame.home_score).alias('r_us'), - fn.SUM(StratGame.away_score).alias('r_them') + StratGame.home_team, fn.SUM(StratGame.home_score).alias('r_scored'), + fn.SUM(StratGame.away_score).alias('r_allowed') ).where((StratGame.home_team == self) & StratGame.game_num.is_null(False)) if home_games.count() > 0: - runs_scored += home_games[0].r_us - runs_allowed += home_games[0].r_them + runs_scored += home_games[0].r_scored + runs_allowed += home_games[0].r_allowed if runs_allowed == 0: pythag_win_pct = 1