From 430ec7352bf7615053823a2167fc6b03df4a00e2 Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Mon, 2 Mar 2026 19:33:58 +0100 Subject: [PATCH] Fix session download counter resetting when packages are removed Session counter now uses sessionDownloadedBytes (in-memory counter) instead of summing completed items. Removing packages after extraction no longer resets the session total. Co-Authored-By: Claude Opus 4.6 --- package.json | 2 +- src/main/download-manager.ts | 17 +---------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 78f7af6..d0e5904 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "real-debrid-downloader", - "version": "1.5.12", + "version": "1.5.13", "description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)", "main": "build/main/main/main.js", "author": "Sucukdeluxe", diff --git a/src/main/download-manager.ts b/src/main/download-manager.ts index 223b6af..58b28c6 100644 --- a/src/main/download-manager.ts +++ b/src/main/download-manager.ts @@ -891,30 +891,15 @@ export class DownloadManager extends EventEmitter { this.resetSessionTotalsIfQueueEmpty(); - let totalDownloaded = 0; let totalFiles = 0; for (const item of Object.values(this.session.items)) { if (item.status === "completed") { - totalDownloaded += item.downloadedBytes; totalFiles += 1; } } - if (this.session.running) { - let visibleRunBytes = 0; - for (const itemId of this.runItemIds) { - const item = this.session.items[itemId]; - if (item) { - visibleRunBytes += item.downloadedBytes; - } - } - totalDownloaded += Math.max(0, this.session.totalDownloadedBytes - visibleRunBytes); - } else { - totalDownloaded = Math.max(totalDownloaded, this.session.totalDownloadedBytes); - } - const stats = { - totalDownloaded, + totalDownloaded: this.sessionDownloadedBytes, totalDownloadedAllTime: this.settings.totalDownloadedAllTime, totalFiles, totalPackages: this.session.packageOrder.length,