diff --git a/src/App.js b/src/App.js index 7966eb8..de15bb5 100644 --- a/src/App.js +++ b/src/App.js @@ -398,7 +398,11 @@ function App() { if (job?.status === 'running') { const total = job.total || 0; const processed = job.processed || 0; - const percent = total > 0 ? Math.min(95, 10 + Math.round((processed / total) * 80)) : undefined; + let percent; + if (total > 0) { + const ratio = Math.max(0, Math.min(1, processed / total)); + percent = Math.min(99, 5 + Math.round(ratio * 90)); + } let etaSeconds = null; if (total > 0 && processed > 0) { const elapsedSeconds = Math.max(1, (Date.now() - jobStartedAt) / 1000); @@ -414,7 +418,7 @@ function App() { updateSyncProgress(message, percent, { etaSeconds }); } else if (!job) { if (statusData.storesFresh) { - updateSyncProgress('Betriebe aktuell.', 90, { etaSeconds: null }); + updateSyncProgress('Betriebe aktuell.', 99, { etaSeconds: null }); completed = true; } else if (!jobStarted) { await triggerRefresh(); @@ -423,7 +427,7 @@ function App() { updateSyncProgress('Warte auf Rückmeldung...', undefined, { etaSeconds: null }); } } else if (job.status === 'done') { - updateSyncProgress('Synchronisierung abgeschlossen', 95, { etaSeconds: null }); + updateSyncProgress('Synchronisierung abgeschlossen', 100, { etaSeconds: null }); completed = true; } else if (job.status === 'error') { throw new Error(job.error || 'Unbekannter Fehler beim Prüfen der Betriebe.');