From d2a4b13284318720b9a6bc08dcdb5c99fc203f2b Mon Sep 17 00:00:00 2001 From: Oj Date: Tue, 26 Apr 2022 20:25:13 +0100 Subject: [PATCH] [Splash > Backend] Minor source cleanup --- src/splash/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/splash/index.js b/src/splash/index.js index d26de68..561ac13 100644 --- a/src/splash/index.js +++ b/src/splash/index.js @@ -104,8 +104,7 @@ class UIProgress { // Generic class to track updating and sent states to splash send() { if ((toSend === -1 && this.progress.size > 0 && this.progress.size > this.done.size) || toSend === this.st) { - const progress = [...this.progress.values()].reduce((a, x) => a + x[0], 0) / [...this.progress.values()].reduce((a, x) => a + x[1], 0) * 100; - if (progress > 100) return true; + const progress = Math.min(100, [...this.progress.values()].reduce((a, x) => a + x[0], 0) / [...this.progress.values()].reduce((a, x) => a + x[1], 0) * 100); // Clamp progress to 0-100 sendState(this.st ? 'installing' : 'downloading', { current: this.done.size + 1,