fix: improve progress accuracy in slicing mode
This commit is contained in:
+5
-5
@@ -379,7 +379,7 @@ $.set('#subcategory', 'change', (e) => {
|
||||
});
|
||||
|
||||
$.set('#chunksize', 'change', (e) => {
|
||||
let limit = minor || major - 1;
|
||||
let limit = Math.max(minor, major - 1);
|
||||
let value = Math.floor(limit / e.target.valueAsNumber);
|
||||
$('#limit').value = value;
|
||||
$('#offset').max = value;
|
||||
@@ -452,17 +452,17 @@ while (await new Promise(o => setTimeout(o, 1000, true))) {
|
||||
let limit = minor || major - 1;
|
||||
let chunk = $('#chunksize').valueAsNumber;
|
||||
let total = $('#slice').checked ? Math.min(chunk, limit - chunk * $('#offset').valueAsNumber) : limit;
|
||||
let index = $('#slice').checked ? done + skip - omit : done + skip;
|
||||
let count = $('#slice').checked ? done + skip - omit : done + skip;
|
||||
|
||||
$('#progressLabel').innerText = `${parseFloat(index / total * 100).toFixed(2)}% (${index}/${total})`;
|
||||
$('#progressLabel').innerText = `${parseFloat(count / total * 100).toFixed(2)}% (${count}/${total})`;
|
||||
$('#subjectLabel').innerText = subject ?? '';
|
||||
$('#recipientLabel').innerText = recipient ? `${recipient} <${email}>` : email ?? '';
|
||||
|
||||
let uptime = await Rpc2.invoke('uptime').catch(() => 0);
|
||||
$('#uptimeLabel').innerText = Temporal.Duration.from({ seconds: uptime }).round({ largestUnit: 'hours' }).toLocaleString('en', { style: 'digital' });
|
||||
|
||||
let rate = index / uptime;
|
||||
let remaining = index ? Math.floor((total - index) / rate) : 0;
|
||||
let rate = count / uptime;
|
||||
let remaining = count ? Math.floor((total - count) / rate) : 0;
|
||||
$('#remainingLabel').innerText = remaining >= 0 ? `${Temporal.Duration.from({ seconds: remaining }).round({ largestUnit: 'hours' }).toLocaleString('en')} (${(rate * 60).toFixed(2)}/min)` : '';
|
||||
break;
|
||||
case 'STANDBY':
|
||||
|
||||
Reference in New Issue
Block a user