▍ humdrum codex / soft

TUI Scores: reformat each line as date · teams · score ('Now' for live)

9c9548485082feff504dc6e1ae95e1f43ca35168
humdrum <me@humdrum.me> · 2026-07-08 19:55

parent 886fac39

TUI Scores: reformat each line as date · teams · score ('Now' for live)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

1 files changed

tui/dashboard.py +22 −10
@@ -419,8 +419,21 @@         return 1
     return 2
 
 
-def _game_label(g: dict) -> tuple[str, str]:
-    """The left-hand status column for one game — (text, style)."""
+def _game_date(g: dict) -> str:
+    """Leading date column — 'Now' while live, else the game's local date."""
+    if g.get("state") == "in":
+        return "Now"
+    st = g.get("startTime")
+    if st:
+        try:
+            return to_local(st).strftime("%b %-d")
+        except Exception:
+            pass
+    return "—"
+
+
+def _game_score(g: dict) -> tuple[str, str]:
+    """Trailing score/status column for one game — (text, style)."""
     state = g.get("state")
     away_sc = g.get("awayScore")
     home_sc = g.get("homeScore")
@@ -434,23 +447,22 @@         # Final: score + "F"
         score = f"{away_sc}–{home_sc}" if away_sc is not None and home_sc is not None else "—"
         final_tag = "F/OT" if "OT" in (status or "") else "F"
         return f"{score} {final_tag}", "dim"
-    # Scheduled: start time (bare time if today, else weekday + date)
+    # Scheduled: start time of day (the date is in its own column)
     st = g.get("startTime")
     if st:
         try:
-            d = to_local(st)
-            is_today = d.date() == date.today()
-            return (d.strftime("%-I:%M %p") if is_today else d.strftime("%a %-d  %-I:%M %p")), "dim"
+            return to_local(st).strftime("%-I:%M %p"), "dim"
         except Exception:
             pass
     return status, "dim"
 
 
 def _append_game_line(t: Text, g: dict) -> None:
-    lbl, lbl_style = _game_label(g)
-    t.append("    ")
-    t.append(f"{lbl:<18}", style=lbl_style)
-    t.append(f"{g.get('away', '?')} @ {g.get('home', '?')}\n")
+    # date · teams · score
+    score, score_style = _game_score(g)
+    t.append(f"  {_game_date(g):<7}", style="dim")
+    t.append(f"{g.get('away', '?')} @ {g.get('home', '?')}")
+    t.append(f"  {score}\n", style=score_style)
 
 
 # Favorites are grouped by status, not league. state → section header.