WS1: fix date parsing in seed counts (integration lead commit after worker iteration limit)
This commit is contained in:
parent
ba51a00f2b
commit
9be1fd991b
1 changed files with 13 additions and 5 deletions
|
|
@ -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"])
|
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
|
# 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()
|
today = datetime.now(timezone.utc).date()
|
||||||
deadline_window = today + timedelta(days=7)
|
deadline_window = today + timedelta(days=7)
|
||||||
deadline_count = sum(
|
deadline_count = 0
|
||||||
1 for p in postings
|
for p in postings:
|
||||||
if p.get("apply_by") and today <= p["apply_by"] <= deadline_window
|
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
|
# Pending email suggestions
|
||||||
from app.imap_watch import list_pending_suggestions
|
from app.imap_watch import list_pending_suggestions
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue