Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-19 01:11:11 +00:00
co-authored by renee-png
parent 62310e462f
commit 1afa2d67c0
+27
View File
@@ -930,6 +930,33 @@ function ImportPage() {
const summary = { total: rawRows.length, inserted, skipped, errors, skipReasons };
setResults((r) => ({ ...r, [cfg.key]: summary }));
// Persist run history (best-effort)
const runRow = {
importer_key: cfg.key,
total: rawRows.length,
inserted,
skipped,
error_count: errors.length,
ran_by: user.id,
};
void supabase.from("import_runs" as any).insert(runRow as any).then(({ error: runErr }) => {
if (runErr) {
console.warn("[import] failed to record run", runErr);
return;
}
setLastRuns((prev) => ({
...prev,
[cfg.key]: {
ran_at: new Date().toISOString(),
total: rawRows.length,
inserted,
skipped,
error_count: errors.length,
},
}));
});
if (errors.length === 0) {
const extra = mirrored > 0 ? ` (+${mirrored} mirrored to Clients)` : "";
toast.success(`${cfg.label}: ${inserted} imported${extra}`);