From a8bdb70e08d3860ac005f60cf56ef138a4e2ad53 Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Wed, 4 Nov 2026 05:17:54 +0000 Subject: [PATCH] allowances: fix decision-label mapping (would_renew not would_renewed) --- app/main.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/main.py b/app/main.py index 0947c93..c264fcf 100644 --- a/app/main.py +++ b/app/main.py @@ -4364,7 +4364,9 @@ async def reconcile_allowances(send: bool = False) -> dict: now = datetime.now(timezone.utc) contribute = credit_pack_url() verified = "on" if (send and ALLOWANCE_POLICY == "on") else "report" - label = (lambda a: a) if verified == "on" else (lambda a: "would_" + a) + _APPLIED = {"renew": "renewed", "remind": "reminded", "deactivate": "deactivated"} + _WOULD = {"renew": "would_renew", "remind": "would_remind", "deactivate": "would_deactivate"} + label = (lambda a: _APPLIED[a]) if verified == "on" else (lambda a: _WOULD[a]) decisions: list[dict] = [] counts = {"renewed": 0, "reminded": 0, "deactivated": 0, "would_renew": 0, "would_remind": 0, "would_deactivate": 0, "in_grace": 0, @@ -4416,7 +4418,7 @@ async def reconcile_allowances(send: bool = False) -> dict: if paid: next_reset = next_reset_for_anchor_day(anchor_day, now) evidence = f"{evidence}; reset anchored to join-day {anchor_day} → next reset {next_reset.date().isoformat()}" - decision = label("renewed") + decision = label("renew") counts[decision] += 1 if verified == "on": try: @@ -4431,7 +4433,7 @@ async def reconcile_allowances(send: bool = False) -> dict: (email, cycle_key), ).fetchone() if not reminded: - decision = label("reminded") + decision = label("remind") counts[decision] += 1 if verified == "on": subject, text_body, html_body = payment_reminder_email(oc_slug or slug or "there", contribute) @@ -4448,7 +4450,7 @@ async def reconcile_allowances(send: bool = False) -> dict: sent_at = _parse_oc_dt(str(reminded[0])) elapsed = (now - sent_at).days if sent_at else None if elapsed is not None and elapsed >= PAYMENT_GRACE_DAYS and ALLOWANCE_DEACTIVATE == "on": - decision = label("deactivated") + decision = label("deactivate") counts[decision] += 1 evidence = f"{evidence}; reminder sent {str(reminded[0])[:10]}, grace {int(PAYMENT_GRACE_DAYS)}d elapsed" if verified == "on":