Evite les doublons

This commit is contained in:
2026-07-04 19:17:56 +02:00
parent b138bc53ee
commit 8834236840
3 changed files with 73 additions and 18 deletions
@@ -406,7 +406,11 @@ export default function ImportsSection() {
});
setResult({
ok: true,
msg: `✔ Import terminé : ${r.inserted} / ${r.total} lignes insérées${r.skipped > 0 ? `, ${r.skipped} ignorées` : ''}.${r.errors?.length > 0 ? ` (${r.errors.length} avertissement(s))` : ''}`,
msg: `✔ Import terminé : ${r.inserted} / ${r.total} lignes insérées`
+ (r.duplicates > 0 ? `, ${r.duplicates} doublon(s) ignoré(s)` : '')
+ (r.skipped > 0 ? `, ${r.skipped} ignorée(s)` : '')
+ '.'
+ (r.errors?.length > 0 ? ` (${r.errors.length} avertissement(s))` : ''),
});
setPreview(null); setFile(null); setMapping({}); setDefaults({});
api.get('/imports/history').then(setHistory).catch(() => {});
@@ -602,12 +606,12 @@ export default function ImportsSection() {
<thead>
<tr>
<th>Date</th><th>Module</th><th>Fichier</th>
<th className="num">Total</th><th className="num">OK</th><th className="num">KO</th>
<th className="num">Total</th><th className="num">OK</th><th className="num">Doublons</th><th className="num">KO</th>
</tr>
</thead>
<tbody>
{history.length === 0 && (
<tr><td colSpan={6} className="text-muted" style={{ textAlign: 'center' }}>Aucun import</td></tr>
<tr><td colSpan={7} className="text-muted" style={{ textAlign: 'center' }}>Aucun import</td></tr>
)}
{history.map(h => (
<tr key={h.id}>
@@ -616,6 +620,7 @@ export default function ImportsSection() {
<td className="text-muted" style={{ fontSize: 11 }}>{h.filename}</td>
<td className="num">{h.rows_total}</td>
<td className="num" style={{ color: 'var(--success)' }}>{h.rows_inserted}</td>
<td className="num" style={{ color: h.rows_duplicates > 0 ? 'var(--text-muted)' : undefined }}>{h.rows_duplicates ?? 0}</td>
<td className="num" style={{ color: h.rows_skipped > 0 ? 'var(--warning)' : undefined }}>{h.rows_skipped}</td>
</tr>
))}