Skip to content

Commit

Permalink
Fix additional rounding errors
Browse files Browse the repository at this point in the history
The points' values earned by calculating note maturity can return non-integer values because of rounding errors
  • Loading branch information
lulunac27a authored Oct 29, 2024
1 parent c8c4bf2 commit bb0aa4a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/randomNotificationText.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,21 +218,21 @@ const boosterFactorMessage : string[] = [
export function getRandomMessageWeeklyChallenge(points: number): string {
const randomIndex = Math.floor(Math.random() * messagesWeeklyChallenge.length);
const message = messagesWeeklyChallenge[randomIndex];
return message.replace("[X]", points.toString());
return message.replace("[X]", Math.round(points).toString());
}


export function getRandomMessageTwoNoteChallenge(points: number): string {
const randomIndex = Math.floor(Math.random() * twoNoteMessages.length);
const message = twoNoteMessages[randomIndex];
return message.replace("[X]", points.toString());
return message.replace("[X]", Math.round(points).toString());
}


export function getRandomMessagePoints(points: number): string {
const randomIndex = Math.floor(Math.random() * randomPointNotices.length);
const message = randomPointNotices[randomIndex];
return message.replace("[X]", points.toString());
return message.replace("[X]", Math.round(points).toString());
}

export function getRandomMessageBoosterFactor(): string {
Expand Down

0 comments on commit bb0aa4a

Please sign in to comment.