From 55b8eb487469c9e0a2a45fa3544a67a0495c933e Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sun, 19 Apr 2026 18:31:46 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 6f53c5b..cb7fe44 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -740,14 +740,19 @@ function ImportPage() { ctx.caseByExt.clear(); ctx.caseByNumber.clear(); ctx.caseByTitle.clear(); - const cases = await fetchAllPaginated<{ id: string; case_number: string | null; title: string | null; external_id: string | null }>( + ctx.activeCaseIds.clear(); + const cases = await fetchAllPaginated<{ id: string; case_number: string | null; title: string | null; external_id: string | null; status: string | null; archived_at: string | null }>( "cases", - "id, case_number, title, external_id", + "id, case_number, title, external_id, status, archived_at", ); + const CLOSED_STATUSES = new Set(["closed", "closed_won", "closed_lost"]); for (const r of cases) { if (r.external_id) ctx.caseByExt.set(r.external_id, r.id); if (r.case_number) ctx.caseByNumber.set(r.case_number, r.id); if (r.title) ctx.caseByTitle.set(r.title.toLowerCase().trim(), r.id); + if (!r.archived_at && !CLOSED_STATUSES.has(String(r.status ?? "").toLowerCase())) { + ctx.activeCaseIds.add(r.id); + } } ctx.userByName.clear(); ctx.userByEmail.clear();