diff --git a/ondeck/.gitignore b/ondeck/.gitignore index f390d12..851cd3c 100644 --- a/ondeck/.gitignore +++ b/ondeck/.gitignore @@ -41,3 +41,4 @@ yarn-error.log* next-env.d.ts /src/generated/prisma +*.sql diff --git a/ondeck/src/app/(dashboard)/tasks/page.tsx b/ondeck/src/app/(dashboard)/tasks/page.tsx index 375f75d..fdab7a3 100644 --- a/ondeck/src/app/(dashboard)/tasks/page.tsx +++ b/ondeck/src/app/(dashboard)/tasks/page.tsx @@ -22,17 +22,21 @@ export default async function TasksPage() { const activeTaskWhere: Prisma.TaskWhereInput = { assignments: { some: { userId } }, - // Exclude tasks on dead policies - NOT: { - policy: { status: { in: ['Cancelled', 'Expired', 'Non-Renewed', 'Rewritten', 'Not taken'] } }, - } as Prisma.TaskWhereInput, - // Exclude tasks on expired renewal groups - OR: [ - { policyGroupId: null }, - { policyGroup: { renewalDate: { gte: cutoff } } }, - ], - // Only show recent or terminal tasks AND: [ + // Exclude dead policies + { + NOT: { + policy: { status: { in: ['Cancelled', 'Expired', 'Non-Renewed', 'Rewritten', 'Not taken'] } }, + }, + }, + // Exclude tasks on expired renewal groups + { + OR: [ + { policyGroupId: null }, + { policyGroup: { renewalDate: { gte: cutoff } } }, + ], + }, + // Only show recent or terminal tasks { OR: [ { dueDate: { gte: cutoff } }, diff --git a/ondeck/src/app/api/tasks/route.ts b/ondeck/src/app/api/tasks/route.ts index 1c2e2fb..d3dce67 100644 --- a/ondeck/src/app/api/tasks/route.ts +++ b/ondeck/src/app/api/tasks/route.ts @@ -29,14 +29,21 @@ export async function GET(request: NextRequest) { const showArchived = searchParams.get('archived') === 'true' if (!showArchived) { - where.NOT = { - policy: { status: { in: ['Cancelled', 'Expired', 'Non-Renewed', 'Rewritten', 'Not taken'] } }, - } - where.OR = [ - { policyGroupId: null }, - { policyGroup: { renewalDate: { gte: cutoff } } }, - ] where.AND = [ + // Exclude dead policies + { + NOT: { + policy: { status: { in: ['Cancelled', 'Expired', 'Non-Renewed', 'Rewritten', 'Not taken'] } }, + }, + }, + // Exclude tasks on expired renewal groups + { + OR: [ + { policyGroupId: null }, + { policyGroup: { renewalDate: { gte: cutoff } } }, + ], + }, + // Exclude old non-terminal tasks { OR: [ { dueDate: { gte: cutoff } },