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:02:02 +00:00
co-authored by renee-png
parent ea8b10a9a3
commit 0d7d39542e
+3 -9
View File
@@ -287,15 +287,9 @@ const IMPORTERS: ImporterConfig[] = [
const bm = String(r.billing_method).toLowerCase();
r.billing_method = bm.includes("flat") ? "flat" : bm.includes("contingency") ? "contingency" : bm.includes("hour") ? "hourly" : null;
}
// Generate a collision-free case number when none was provided.
// Uses crypto.randomUUID so simultaneous rows in the same batch never collide.
if (!r.case_number || !String(r.case_number).trim()) {
const uid = (typeof crypto !== "undefined" && "randomUUID" in crypto)
? crypto.randomUUID().slice(0, 8).toUpperCase()
: `${Date.now().toString(36)}${Math.floor(Math.random() * 1e6).toString(36)}`.toUpperCase();
r.case_number = `CASE-${uid}`;
}
if (!r.title) r.title = r.case_number;
// Leave case_number blank when missing — assigned in a sequential
// "YYYY-####" pass before insert (see below). Do not synthesize title
// from case_number; preserve the imported matter name as-is.
return r;
},
postInsert: (rows, ctx) => {