diff --git a/ui/index.html b/ui/index.html
index 2454da6e..fc849f7d 100644
--- a/ui/index.html
+++ b/ui/index.html
@@ -761,9 +761,11 @@ async function doMakeImage(reqBody, batchCount) {
let overallStepCount = stepUpdate.step + batchesDone * batchSize
let totalSteps = batchCount * batchSize
let percent = 100 * (overallStepCount / totalSteps)
+ percent = (percent > 100 ? 100 : percent)
percent = percent.toFixed(0)
stepsRemaining = totalSteps - overallStepCount
+ stepsRemaining = (stepsRemaining < 0 ? 0 : stepsRemaining)
timeRemaining = (timeTaken === -1 ? '' : stepsRemaining * timeTaken) // ms
outputMsg.innerHTML = `Batch ${batchesDone+1} of ${batchCount}`
@@ -1360,6 +1362,10 @@ function millisecondsToStr(milliseconds) {
s += seconds + ' second' + numberEnding(seconds);
}
+ if (s === '') {
+ s = 'almost done'
+ }
+
return s;
}