web/ProcessingQueue: use full progress per item, not just running task

This commit is contained in:
wukko 2025-01-31 21:59:44 +06:00
parent 398c5402d2
commit 2ae0fd01dd
No known key found for this signature in database
GPG Key ID: 3E30B3F26C7B4AA2

View File

@ -19,11 +19,20 @@
$: queue = Object.entries($readableQueue);
const totalItemProgress = (completed: number, current: number, total: number) => {
return (completed * 100 + current) / total
}
$: totalProgress = queue.length ? queue.map(([, item]) => {
if (item.state === "done" || item.state === "error")
if (item.state === "done" || item.state === "error") {
return 100;
else if (item.state === "running")
return $currentTasks[item.runningWorker]?.progress?.percentage || 0;
} else if (item.state === "running") {
return totalItemProgress(
item.completedWorkers?.length || 0,
$currentTasks[item.runningWorker]?.progress?.percentage || 0,
item.pipeline.length || 0
);
}
return 0;
}).reduce((a, b) => a + b) / (100 * queue.length) : 0;