From 9be1fd991b7bbea400683a9395250d5429f17f4b Mon Sep 17 00:00:00 2001 From: hermes Date: Thu, 30 Jul 2026 21:15:11 +0000 Subject: [PATCH] WS1: fix date parsing in seed counts (integration lead commit after worker iteration limit) --- apps/api/app/main.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/api/app/main.py b/apps/api/app/main.py index 3984733..a74a8f2 100644 --- a/apps/api/app/main.py +++ b/apps/api/app/main.py @@ -1046,13 +1046,21 @@ def _seed_demo_counts() -> dict[str, Any]: cluster_ids = set(p["cluster_id"] for p in cluster_postings if p["cluster_id"]) # Deadlines: postings with apply_by in the next 7 days - from datetime import timedelta + from datetime import date, timedelta today = datetime.now(timezone.utc).date() deadline_window = today + timedelta(days=7) - deadline_count = sum( - 1 for p in postings - if p.get("apply_by") and today <= p["apply_by"] <= deadline_window - ) + deadline_count = 0 + for p in postings: + apply_by_raw = p.get("apply_by") + if not apply_by_raw: + continue + # _normalize_posting returns apply_by as ISO string + if isinstance(apply_by_raw, str): + apply_by_date = date.fromisoformat(apply_by_raw) + else: + apply_by_date = apply_by_raw + if today <= apply_by_date <= deadline_window: + deadline_count += 1 # Pending email suggestions from app.imap_watch import list_pending_suggestions