fix: Sort games chronologically in standings recalculation for accurate streaks
The standings recalculate function was processing games in arbitrary database order, causing win/loss streaks to be calculated incorrectly. Added explicit ordering by week and game_num (ascending) to ensure games are processed chronologically. This fixes inconsistent streak values that were reported due to the streak logic depending on processing games in the correct temporal sequence. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8feed5b104
commit
8b65c45763
@ -1326,7 +1326,8 @@ class Standings(BaseModel):
|
||||
# Iterate through each individual result
|
||||
# for game in Result.select_season(season).where(Result.week <= 22):
|
||||
for game in StratGame.select().where(
|
||||
(StratGame.season == season) & (StratGame.week <= 18) & (StratGame.game_num.is_null(False))):
|
||||
(StratGame.season == season) & (StratGame.week <= 18) & (StratGame.game_num.is_null(False))
|
||||
).order_by(StratGame.week, StratGame.game_num):
|
||||
# tally win and loss for each standings object
|
||||
game.update_standings()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user