Skip to content

Commit

Permalink
fix(bot): correctly avoid division by 0
Browse files Browse the repository at this point in the history
  • Loading branch information
shayypy committed Apr 28, 2024
1 parent fa8ce5a commit 66da4d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/bot/src/ht/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getPointsPct = (
// much an individual game is "worth". Hockeytech uses a static value for
// this and doesn't account for the PWHL's max 3 points per game.
const gamesWorth = league === "pwhl" ? 3 : 2;
return (points / (gamesPlayed * (gamesWorth ?? 1))).toPrecision(3);
return (points / (gamesPlayed * gamesWorth || 1)).toPrecision(3);
};

export const GLOBAL_GAME_ID_REGEX = /^🆔 (pwhl|ahl):(\d+)$/m;

0 comments on commit 66da4d0

Please sign in to comment.