Skip to content

Commit

Permalink
One fix for donation total going up and down sometimes.
Browse files Browse the repository at this point in the history
  • Loading branch information
zoton2 committed Feb 22, 2024
1 parent 9244fa6 commit b6d339d
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/graphics/omnibar/components/Total.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit b6d339d

Please sign in to comment.