Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-19 18:31:46 +00:00
co-authored by renee-png
parent bb41e58c52
commit 55b8eb4874
+7 -2
View File
@@ -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();