From 133dd13c29582f7c10542cb9d6b2befbac1e6381 Mon Sep 17 00:00:00 2001 From: lorentz Date: Wed, 20 May 2026 17:38:51 +0000 Subject: [PATCH] Fix: show completed tasks based on completedAt not dueDate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Terminal tasks (COMPLETED/CANCELLED/NA) were gated on dueDate >= cutoff, so bulk-closed tasks with old due dates never appeared in task lists even though they were just completed. Switch the 7-day recency check to use completedAt instead — a task completed this week always shows regardless of when it was due. --- ondeck/src/app/(dashboard)/clients/[id]/page.tsx | 2 +- ondeck/src/app/(dashboard)/tasks/page.tsx | 4 ++-- ondeck/src/app/api/clients/[id]/tasks/route.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ondeck/src/app/(dashboard)/clients/[id]/page.tsx b/ondeck/src/app/(dashboard)/clients/[id]/page.tsx index a1570a9..05ff44c 100644 --- a/ondeck/src/app/(dashboard)/clients/[id]/page.tsx +++ b/ondeck/src/app/(dashboard)/clients/[id]/page.tsx @@ -75,7 +75,7 @@ export default async function ClientDetailPage({ { AND: [ { status: { in: ['COMPLETED', 'CANCELLED', 'NA'] } }, - { dueDate: { gte: cutoff } }, + { completedAt: { gte: cutoff } }, ], }, ], diff --git a/ondeck/src/app/(dashboard)/tasks/page.tsx b/ondeck/src/app/(dashboard)/tasks/page.tsx index 7881fa3..b5f80b4 100644 --- a/ondeck/src/app/(dashboard)/tasks/page.tsx +++ b/ondeck/src/app/(dashboard)/tasks/page.tsx @@ -36,14 +36,14 @@ export default async function TasksPage() { { policyGroup: { renewalDate: { gte: cutoff } } }, ], }, - // Keep ALL open tasks regardless of age; only hide ancient terminal tasks + // Keep ALL open tasks regardless of age; only show terminal tasks completed/closed recently { OR: [ { status: { notIn: TERMINAL_STATUSES } }, { AND: [ { status: { in: TERMINAL_STATUSES } }, - { dueDate: { gte: cutoff } }, + { completedAt: { gte: cutoff } }, ], }, ], diff --git a/ondeck/src/app/api/clients/[id]/tasks/route.ts b/ondeck/src/app/api/clients/[id]/tasks/route.ts index cbfc3c5..b2c4cab 100644 --- a/ondeck/src/app/api/clients/[id]/tasks/route.ts +++ b/ondeck/src/app/api/clients/[id]/tasks/route.ts @@ -43,7 +43,7 @@ export async function GET( { AND: [ { status: { in: ['COMPLETED', 'CANCELLED', 'NA'] } }, - { dueDate: { gte: cutoff } }, + { completedAt: { gte: cutoff } }, ], }, ],