fix: anchor Day N to each round's first game instead of lazy first sighting
CI / Lint (push) Successful in 5s
CI / Test (push) Successful in 9s
CI / Build & Push (push) Successful in 19s

The banner read "Day 1 of ~60" on day 2 of the playoffs because the old
anchor recorded whatever date we first polled a playoff game as Day 1.
Now round start dates come from /v1/schedule/playoff-series, so Day N
is authoritative and resets at each round boundary. Drops the noisy
"of ~60" denominator.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-19 13:03:08 -04:00
parent 930247b32f
commit a88e2edef0
7 changed files with 220 additions and 94 deletions
+15 -5
View File
@@ -8,11 +8,10 @@ from app.games import parse_games
from app.playoff import today_meta
from app.bracket_view import build_bracket_view
from app.playoff_cache import (
day_n as compute_day_n,
day_n_for_round,
fetch_series,
get_bracket,
parse_series_id,
record_start_date_if_missing,
refresh_bracket,
)
from app.series_view import build_series_view
@@ -22,6 +21,17 @@ from zoneinfo import ZoneInfo
_EASTERN = ZoneInfo("America/New_York")
def _max_playoff_round(raw_games):
max_round = 0
for g in raw_games or []:
if g.get("gameType") != 3:
continue
r = (g.get("seriesStatus") or {}).get("round") or 0
if r > max_round:
max_round = r
return max_round or None
@app.route("/manifest.json")
def manifest():
return send_from_directory(app.static_folder, "manifest.json")
@@ -61,10 +71,10 @@ def get_scoreboard():
if scoreboard_data:
raw_games = scoreboard_data.get("games", [])
record_start_date_if_missing(raw_games)
games = parse_games(scoreboard_data)
n, total = compute_day_n()
meta = today_meta(raw_games, day_n=n, day_total=total)
max_round = _max_playoff_round(raw_games)
n = day_n_for_round(max_round) if max_round else None
meta = today_meta(raw_games, day_n=n)
pinned = [g for g in games if g.get("Pinned")]
remaining = [g for g in games if not g.get("Pinned")]