Skip to content

Commit

Permalink
Hopefully alleviate some more floating point issues
Browse files Browse the repository at this point in the history
  • Loading branch information
zoton2 committed Feb 22, 2024
1 parent b6d339d commit d2f14a2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/graphics/omnibar/components/Total.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ import { replicantModule, replicantNS } from '@esa-layouts/browser_shared/replic
import { formatUSD } from '@esa-layouts/graphics/_misc/helpers';
import { AdditionalDonations } from '@esa-layouts/types/schemas';
import gsap from 'gsap';
import { round } from 'lodash';
import { Component, Vue } from 'vue-property-decorator';
@Component
Expand Down Expand Up @@ -170,7 +171,7 @@ export default class extends Vue {
}
get rawTotal(): number {
return replicantModule.repsTyped.donationTotal + this.additionalDonationsAmount;
return round(replicantModule.repsTyped.donationTotal + this.additionalDonationsAmount, 2);
}
get totalStr(): string {
Expand Down Expand Up @@ -239,7 +240,7 @@ 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).
const completeTotal = data.total + this.additionalDonationsAmount;
const completeTotal = round(data.total + this.additionalDonationsAmount, 2);
if (!this.playingAlerts && completeTotal !== this.total) {
nodecg.sendMessage(
'donationAlertsLogging',
Expand Down

0 comments on commit d2f14a2

Please sign in to comment.