forked from extern/easydiffusion
Fix a bug where negative steps remaining would mess up the countdown
This commit is contained in:
parent
ef1bbda49c
commit
95f01007a3
@ -761,9 +761,11 @@ async function doMakeImage(reqBody, batchCount) {
|
|||||||
let overallStepCount = stepUpdate.step + batchesDone * batchSize
|
let overallStepCount = stepUpdate.step + batchesDone * batchSize
|
||||||
let totalSteps = batchCount * batchSize
|
let totalSteps = batchCount * batchSize
|
||||||
let percent = 100 * (overallStepCount / totalSteps)
|
let percent = 100 * (overallStepCount / totalSteps)
|
||||||
|
percent = (percent > 100 ? 100 : percent)
|
||||||
percent = percent.toFixed(0)
|
percent = percent.toFixed(0)
|
||||||
|
|
||||||
stepsRemaining = totalSteps - overallStepCount
|
stepsRemaining = totalSteps - overallStepCount
|
||||||
|
stepsRemaining = (stepsRemaining < 0 ? 0 : stepsRemaining)
|
||||||
timeRemaining = (timeTaken === -1 ? '' : stepsRemaining * timeTaken) // ms
|
timeRemaining = (timeTaken === -1 ? '' : stepsRemaining * timeTaken) // ms
|
||||||
|
|
||||||
outputMsg.innerHTML = `Batch ${batchesDone+1} of ${batchCount}`
|
outputMsg.innerHTML = `Batch ${batchesDone+1} of ${batchCount}`
|
||||||
@ -1360,6 +1362,10 @@ function millisecondsToStr(milliseconds) {
|
|||||||
s += seconds + ' second' + numberEnding(seconds);
|
s += seconds + ' second' + numberEnding(seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (s === '') {
|
||||||
|
s = 'almost done'
|
||||||
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user