mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2024-11-10 17:04:49 +08:00
protecting against negative xp
This commit is contained in:
parent
a15285d044
commit
75d635eef5
1 changed files with 12 additions and 0 deletions
|
@ -412,6 +412,18 @@ export async function addResult(
|
|||
streak
|
||||
);
|
||||
|
||||
if (xpGained.xp < 0) {
|
||||
throw new MonkeyError(
|
||||
500,
|
||||
"Calculated XP is negative",
|
||||
JSON.stringify({
|
||||
xpGained,
|
||||
result,
|
||||
}),
|
||||
uid
|
||||
);
|
||||
}
|
||||
|
||||
const weeklyXpLeaderboardConfig = req.ctx.configuration.leaderboards.weeklyXp;
|
||||
let weeklyXpLeaderboardRank = -1;
|
||||
const eligibleForWeeklyXpLeaderboard =
|
||||
|
|
Loading…
Reference in a new issue