fix: expliciter le résultat des imports manuels

This commit is contained in:
Manus
2026-10-02 21:10:42 +00:00
parent ba4e42c7f1
commit 1617267128
3 changed files with 68 additions and 7 deletions

View File

@@ -0,0 +1,17 @@
export type ImportResultSummary = {
importedCount: number;
duplicateCount: number;
errorCount: number;
};
/** Extrait le résultat final affiché par les services d'import. */
export function parseImportResultSummary(progress: string | null | undefined): ImportResultSummary | null {
if (!progress) return null;
const match = progress.match(/Termin[ée]\s*:\s*(\d+)\s+importée\(s\),\s*(\d+)\s+doublon\(s\)(?:,\s*(\d+)\s+erreur\(s\))?/i);
if (!match) return null;
return {
importedCount: Number(match[1]),
duplicateCount: Number(match[2]),
errorCount: Number(match[3] ?? 0),
};
}