From 1da2a9a2cb54b5e514be35a8323900f5380ffaac Mon Sep 17 00:00:00 2001 From: Chaim Date: Sun, 17 May 2026 16:41:38 +0000 Subject: [PATCH] fix: exclude archived cases from stale-case-reminder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Archived cases have archived_at IS NOT NULL — they are not "stuck", they are done. The stale query was missing this filter. Co-Authored-By: Claude Sonnet 4.6 --- web/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/web/app.py b/web/app.py index eb714bf..175aa7e 100644 --- a/web/app.py +++ b/web/app.py @@ -1148,6 +1148,7 @@ async def api_stale_cases(days: int = 3): EXTRACT(DAY FROM (now() - updated_at))::int AS days_stale FROM cases WHERE status NOT IN ('final', 'new', 'exported') + AND archived_at IS NULL AND updated_at < now() - make_interval(days => $1) ORDER BY updated_at ASC -- oldest stale first (longest overdue = highest priority) """,