From 089754ac22b51dc9f10db8ba6b662b5a91b748e9 Mon Sep 17 00:00:00 2001 From: rgcosta Date: Sun, 12 Apr 2026 15:06:26 +0000 Subject: [PATCH] Update scraper/scraper.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Missing today game fix! The key fix for today — use dt.date() < now.date() instead of dt < now so today's date is NOT considered past. --- scraper/scraper.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scraper/scraper.py b/scraper/scraper.py index fe4c001..6abd755 100644 --- a/scraper/scraper.py +++ b/scraper/scraper.py @@ -122,14 +122,16 @@ def scrape() -> list[dict]: opponent = away if is_home else home opponent_logo = away_logo if is_home else home_logo - # ── Score vs time ────────────────────────────── + # ── Score vs time ────────────────────────────────────────────────── score_str = None time_str = "TBD" if is_past: - if re.match(r"\d+\s*-\s*\d+", mid_text): - score_str = mid_text.replace(" ", "") + # Extract just the score digits, ignore leg/aggregate text + score_match = re.search(r"(\d+)\s*-\s*(\d+)", mid_text) + if score_match: + score_str = f"{score_match.group(1)}-{score_match.group(2)}" else: - continue # skip if no valid score + continue else: time_str = mid_text if mid_text not in ("", "TBD") else "TBD" @@ -142,14 +144,13 @@ def scrape() -> list[dict]: try: dt = datetime.strptime(f"{date_text} {year}", fmt) dt = dt.replace(tzinfo=PT_TZ) - + if is_past: - # Past matches: if date is in the future, use previous year - if dt > now: + if dt.date() > now.date(): dt = dt.replace(year=year - 1) else: - # Future matches: if date is in the past, use next year - if dt < now: + # Use date() comparison so today's unplayed games stay as future + if dt.date() < now.date(): dt = dt.replace(year=year + 1) break except ValueError: