Sort pinned packages by progress: most completed items first
Some checks are pending
Build and Release / build (push) Waiting to run
Some checks are pending
Build and Release / build (push) Waiting to run
Active packages are now sorted by completed item count (descending), then by downloaded bytes, so packages with real download progress appear above packages still in link resolution phase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e0eb3f0453
commit
45b0d71dd0
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "real-debrid-downloader",
|
||||
"version": "1.4.84",
|
||||
"version": "1.4.85",
|
||||
"description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)",
|
||||
"main": "build/main/main/main.js",
|
||||
"author": "Sucukdeluxe",
|
||||
|
||||
@ -688,6 +688,19 @@ export function App(): ReactElement {
|
||||
if (active.length === 0 || active.length === packages.length) {
|
||||
return packages;
|
||||
}
|
||||
// Sort active packages: most progress first (completed items, then downloaded bytes)
|
||||
active.sort((a, b) => {
|
||||
const aItems = a.itemIds.map((id) => snapshot.session.items[id]).filter(Boolean);
|
||||
const bItems = b.itemIds.map((id) => snapshot.session.items[id]).filter(Boolean);
|
||||
const aCompleted = aItems.filter((i) => i.status === "completed").length;
|
||||
const bCompleted = bItems.filter((i) => i.status === "completed").length;
|
||||
if (aCompleted !== bCompleted) {
|
||||
return bCompleted - aCompleted;
|
||||
}
|
||||
const aBytes = aItems.reduce((s, i) => s + (i.downloadedBytes || 0), 0);
|
||||
const bBytes = bItems.reduce((s, i) => s + (i.downloadedBytes || 0), 0);
|
||||
return bBytes - aBytes;
|
||||
});
|
||||
return [...active, ...rest];
|
||||
}, [packages, snapshot.session.running, snapshot.session.items]);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user