feat: make scoreboard playoff-aware with banner, bracket, and series drill-down
Turn a regular-season-looking Tuesday into a full playoff experience: - Playoff banner with round + day + series + elimination counts, gold/silver Cup theme toggled by body.playoff-mode - Series context on each playoff card: round chip, series score, stake badges (GAME 7, CLINCHER, PIVOTAL), and one-line blurb - Game 7s pin to a new Spotlight section above Live - Playoff OT renders with SUDDEN DEATH badge and pulsing gold border - Client-side OT notifications via bell button in the banner - New /series/<id> drill-down with headline, next-game, and game-by-game history - New /bracket page: 7-column desktop grid, accordion on mobile - Day N banner count auto-anchors on first playoff scoreboard hit - SQLite cache for bracket + per-series schedules, stale-on-failure up to 24h Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+28
-2
@@ -4,6 +4,17 @@ from datetime import datetime, timezone
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from app.config import DB_PATH
|
||||
from app.playoff import (
|
||||
is_pinned,
|
||||
is_playoff_game,
|
||||
is_playoff_ot,
|
||||
ot_label,
|
||||
series_badges,
|
||||
series_blurb,
|
||||
series_id,
|
||||
series_state,
|
||||
series_summary,
|
||||
)
|
||||
|
||||
EASTERN = ZoneInfo("America/New_York")
|
||||
|
||||
@@ -100,15 +111,30 @@ def parse_games(scoreboard_data):
|
||||
game, game["awayTeam"]["name"]["default"]
|
||||
),
|
||||
"Last Period Type": get_game_outcome(game, game_state),
|
||||
"Is Playoff": is_playoff_game(game),
|
||||
"Pinned": is_pinned(game),
|
||||
"Playoff OT": is_playoff_ot(game),
|
||||
"OT Label": ot_label(game.get("periodDescriptor", {}).get("number", 0))
|
||||
if is_playoff_ot(game)
|
||||
else "",
|
||||
"Series Blurb": series_blurb(game) if is_playoff_game(game) else "",
|
||||
"Series Summary": series_summary(game) if is_playoff_game(game) else "",
|
||||
"Series Badges": series_badges(game) if is_playoff_game(game) else [],
|
||||
"Series State": series_state(game.get("seriesStatus", {}))
|
||||
if is_playoff_game(game)
|
||||
else None,
|
||||
"Series ID": series_id(game) if is_playoff_game(game) else None,
|
||||
}
|
||||
)
|
||||
|
||||
def _sort_key(g):
|
||||
# Pinned playoff games (Game 7s) sort first within their state bucket.
|
||||
pin_rank = 0 if g.get("Pinned") else 1
|
||||
if g["Game State"] == "PRE":
|
||||
# Earliest start first — ISO-8601 sorts correctly as a string
|
||||
return (0, g["Start Time UTC"], 0)
|
||||
return (pin_rank, 0, g["Start Time UTC"], 0)
|
||||
# LIVE / FINAL — highest priority first
|
||||
return (1, "", -g["Priority"])
|
||||
return (pin_rank, 1, "", -g["Priority"])
|
||||
|
||||
return sorted(extracted_info, key=_sort_key)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user