From b6d339d493b6ec9dbef4a1080fdfbf31c55b115a Mon Sep 17 00:00:00 2001 From: zoton2 Date: Thu, 22 Feb 2024 20:07:29 +0100 Subject: [PATCH] One fix for donation total going up and down sometimes. --- src/graphics/omnibar/components/Total.vue | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/graphics/omnibar/components/Total.vue b/src/graphics/omnibar/components/Total.vue index 43cfe890..a13ddd89 100644 --- a/src/graphics/omnibar/components/Total.vue +++ b/src/graphics/omnibar/components/Total.vue @@ -164,10 +164,13 @@ export default class extends Vue { })); } - get rawTotal(): number { - const additional = this.additionalDonationsMapped + get additionalDonationsAmount() { + return this.additionalDonationsMapped .filter((d) => d.active).reduce((partialSum, a) => partialSum + a.amount, 0); - return replicantModule.repsTyped.donationTotal + additional; + } + + get rawTotal(): number { + return replicantModule.repsTyped.donationTotal + this.additionalDonationsAmount; } get totalStr(): string { @@ -236,13 +239,14 @@ export default class extends Vue { // Double check if the total really needs updating. // Also, only queue if alerts are not already // (the play system will check the final total at the end anyway). - if (!this.playingAlerts && data.total !== this.total) { + const completeTotal = data.total + this.additionalDonationsAmount; + if (!this.playingAlerts && completeTotal !== this.total) { nodecg.sendMessage( 'donationAlertsLogging', 'donationTotalTimeout decided we should push a new total as an alert', ); this.alertList.push({ - total: data.total, + total: completeTotal, showAlert: false, }); if (!this.playingAlerts) this.playNextAlert(true);