[Splash > Backend] Minor source cleanup
This commit is contained in:
parent
ed73901be0
commit
d2a4b13284
|
@ -104,8 +104,7 @@ class UIProgress { // Generic class to track updating and sent states to splash
|
||||||
|
|
||||||
send() {
|
send() {
|
||||||
if ((toSend === -1 && this.progress.size > 0 && this.progress.size > this.done.size) || toSend === this.st) {
|
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;
|
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
|
||||||
if (progress > 100) return true;
|
|
||||||
|
|
||||||
sendState(this.st ? 'installing' : 'downloading', {
|
sendState(this.st ? 'installing' : 'downloading', {
|
||||||
current: this.done.size + 1,
|
current: this.done.size + 1,
|
||||||
|
|
Loading…
Reference in New Issue