TUI: render scores as Final / Today / Upcoming
a108f506c65df550abae46f1424257378c5b2f4d
humdrum <me@humdrum.me> · 2026-07-08 16:18
parent cdf32585
1 files changed
tui/dashboard.py +7 −7
@@ -420,10 +420,10 @@
def _game_bucket(g: dict) -> str:
state = g.get("state")
- if state == "in":
- return "live"
if state == "post":
- return "live"
+ return "final"
+ if state == "in":
+ return "today"
# pre or unknown — classify by date
st = g.get("startTime")
if st:
@@ -436,19 +436,19 @@ return "today"
def render_sports(p: dict) -> Text:
- all_games = [g for g in p.get("games", []) if within_7_days(g.get("startTime"))]
+ all_games = p.get("games", [])
if not all_games:
return Text("No games.", style="dim italic")
- buckets: dict[str, list[dict]] = {"live": [], "today": [], "upcoming": []}
+ buckets: dict[str, list[dict]] = {"final": [], "today": [], "upcoming": []}
for g in all_games:
buckets[_game_bucket(g)].append(g)
- HEADERS = {"live": "Live / Final", "today": "Today", "upcoming": "Upcoming"}
+ HEADERS = {"final": "Final", "today": "Today", "upcoming": "Upcoming"}
t = Text()
first_section = True
- for key in ("live", "today", "upcoming"):
+ for key in ("final", "today", "upcoming"):
games = buckets[key]
if not games:
continue