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 <noreply@anthropic.com>
This commit is contained in:
parent
bc70ff94cc
commit
430ec7352b
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "real-debrid-downloader",
|
"name": "real-debrid-downloader",
|
||||||
"version": "1.5.12",
|
"version": "1.5.13",
|
||||||
"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",
|
||||||
|
|||||||
@ -891,30 +891,15 @@ export class DownloadManager extends EventEmitter {
|
|||||||
|
|
||||||
this.resetSessionTotalsIfQueueEmpty();
|
this.resetSessionTotalsIfQueueEmpty();
|
||||||
|
|
||||||
let totalDownloaded = 0;
|
|
||||||
let totalFiles = 0;
|
let totalFiles = 0;
|
||||||
for (const item of Object.values(this.session.items)) {
|
for (const item of Object.values(this.session.items)) {
|
||||||
if (item.status === "completed") {
|
if (item.status === "completed") {
|
||||||
totalDownloaded += item.downloadedBytes;
|
|
||||||
totalFiles += 1;
|
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 = {
|
const stats = {
|
||||||
totalDownloaded,
|
totalDownloaded: this.sessionDownloadedBytes,
|
||||||
totalDownloadedAllTime: this.settings.totalDownloadedAllTime,
|
totalDownloadedAllTime: this.settings.totalDownloadedAllTime,
|
||||||
totalFiles,
|
totalFiles,
|
||||||
totalPackages: this.session.packageOrder.length,
|
totalPackages: this.session.packageOrder.length,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user