ui: ETA starts at 30s/card and shows 'gleich fertig' under 10s
This commit is contained in:
@@ -527,15 +527,23 @@ async function pollJob(jobId){
|
|||||||
const avgPerCard = elapsedSec / done;
|
const avgPerCard = elapsedSec / done;
|
||||||
aiEtaBaseSec = (total - done) * avgPerCard;
|
aiEtaBaseSec = (total - done) * avgPerCard;
|
||||||
aiEtaBaseTs = now;
|
aiEtaBaseTs = now;
|
||||||
|
} else if (done === 0 && total > 0) {
|
||||||
|
aiEtaBaseSec = total * 30;
|
||||||
|
aiEtaBaseTs = aiJobClientStartTs || now;
|
||||||
} else {
|
} else {
|
||||||
aiEtaBaseSec = null;
|
aiEtaBaseSec = null;
|
||||||
aiEtaBaseTs = null;
|
aiEtaBaseTs = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((aiEtaBaseSec == null || aiEtaBaseTs == null) && done === 0 && total > 0) {
|
||||||
|
aiEtaBaseSec = total * 30;
|
||||||
|
aiEtaBaseTs = aiJobClientStartTs || now;
|
||||||
|
}
|
||||||
|
|
||||||
if (aiEtaBaseSec != null && aiEtaBaseTs != null && total > done) {
|
if (aiEtaBaseSec != null && aiEtaBaseTs != null && total > done) {
|
||||||
const countdown = Math.max(0, aiEtaBaseSec - ((now - aiEtaBaseTs) / 1000));
|
const countdown = Math.max(0, aiEtaBaseSec - ((now - aiEtaBaseTs) / 1000));
|
||||||
etaTxt = ` – Restdauer ~${fmtDuration(countdown)}`;
|
etaTxt = countdown < 10 ? ' – gleich fertig' : ` – Restdauer ~${fmtDuration(countdown)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById('aiProgressText').textContent = `${done}/${total} (${j.progress||0}%)${etaTxt}`;
|
document.getElementById('aiProgressText').textContent = `${done}/${total} (${j.progress||0}%)${etaTxt}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user