From 9a8eeee7ab96329411571e1d5b3e4e71c2390103 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 17:41:29 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 6147976..2329218 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -243,13 +243,22 @@ const IMPORTERS: ImporterConfig[] = [ delete r._clientext; delete r._clientname; delete r._assignedname; delete r._originatingname; if (!r.client_id) return null; - const closedFlag = String(r._closedflag ?? "").toLowerCase(); + const closedFlag = String(r._closedflag ?? "").toLowerCase().trim(); delete r._closedflag; - const s = String(r.status ?? "").toLowerCase(); + const s = String(r.status ?? "").toLowerCase().trim(); + // Only set status when we have an explicit, unambiguous signal. + // Otherwise leave status unset so upsert preserves existing value + // (and new rows fall back to the column default of 'intake'). if (closedFlag === "yes" || closedFlag === "true" || closedFlag === "1") { r.status = "closed"; + } else if (s === "closed" || s === "active" || s === "on_hold" || s === "intake") { + r.status = s; + } else if (s === "open") { + r.status = "active"; + } else if (s === "on hold" || s === "hold") { + r.status = "on_hold"; } else { - r.status = s.includes("close") ? "closed" : s.includes("hold") ? "on_hold" : s.includes("intake") ? "intake" : "active"; + delete r.status; } // Normalise billing method if (r.billing_method) {