From d2c97127370e50324c8dd76cae9c1e172ca3def2 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 02:23:54 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/routes/settings.import.tsx | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/routes/settings.import.tsx b/src/routes/settings.import.tsx index 30bee66..d8b3b97 100644 --- a/src/routes/settings.import.tsx +++ b/src/routes/settings.import.tsx @@ -582,6 +582,11 @@ function ImportPage() { const mapped: Row[] = []; let skipped = 0; const errors: string[] = []; + const skipReasons: Record = {}; + const bumpSkip = (reason: string) => { + skipped++; + skipReasons[reason] = (skipReasons[reason] ?? 0) + 1; + }; for (const raw of rawRows) { const row: Row = {}; @@ -598,7 +603,19 @@ function ImportPage() { // transform const transformed = cfg.transform ? cfg.transform(row, ctx) : row; - if (!transformed) { skipped++; continue; } + if (!transformed) { + // Diagnose common transform-rejection reasons for clearer feedback + if (cfg.table === "homeowners" && !row.client_id && !row._clientext && !row._clientname) { + bumpSkip("no client match (missing companyid/company)"); + } else if (cfg.table === "homeowners" && (row._clientext || row._clientname) && !row.client_id) { + bumpSkip("client not found in existing clients (import companies first)"); + } else if ((cfg.table === "cases" || cfg.table === "invoices") && !row.client_id) { + bumpSkip("client not found"); + } else { + bumpSkip("rejected by transform"); + } + continue; + } // archived → archived_at (only on tables that support it) if ("_archived" in transformed) { @@ -611,7 +628,7 @@ function ImportPage() { // required check const missing = cfg.required.find((k) => !transformed[k] && transformed[k] !== 0); - if (missing) { skipped++; continue; } + if (missing) { bumpSkip(`missing required: ${missing}`); continue; } // attach created_by where not present if (!transformed.created_by && !["time_entries", "expenses", "comments"].includes(cfg.table)) {