fix: expliciter le résultat des imports manuels
This commit is contained in:
17
shared/importResultSummary.ts
Normal file
17
shared/importResultSummary.ts
Normal 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),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user