Sort pinned packages by progress: most completed items first
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:
Sucukdeluxe 2026-03-02 12:53:54 +01:00
parent e0eb3f0453
commit 45b0d71dd0
2 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "real-debrid-downloader", "name": "real-debrid-downloader",
"version": "1.4.84", "version": "1.4.85",
"description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)", "description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)",
"main": "build/main/main/main.js", "main": "build/main/main/main.js",
"author": "Sucukdeluxe", "author": "Sucukdeluxe",

View File

@ -688,6 +688,19 @@ export function App(): ReactElement {
if (active.length === 0 || active.length === packages.length) { if (active.length === 0 || active.length === packages.length) {
return packages; 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]; return [...active, ...rest];
}, [packages, snapshot.session.running, snapshot.session.items]); }, [packages, snapshot.session.running, snapshot.session.items]);