Fix: show completed tasks based on completedAt not dueDate

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.
This commit is contained in:
lorentz 2026-05-20 17:38:51 +00:00
parent 79b6991b31
commit 133dd13c29
3 changed files with 4 additions and 4 deletions

View file

@ -75,7 +75,7 @@ export default async function ClientDetailPage({
{
AND: [
{ status: { in: ['COMPLETED', 'CANCELLED', 'NA'] } },
{ dueDate: { gte: cutoff } },
{ completedAt: { gte: cutoff } },
],
},
],

View file

@ -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 } },
],
},
],

View file

@ -43,7 +43,7 @@ export async function GET(
{
AND: [
{ status: { in: ['COMPLETED', 'CANCELLED', 'NA'] } },
{ dueDate: { gte: cutoff } },
{ completedAt: { gte: cutoff } },
],
},
],