Skip to content

Commit

Permalink
Merge pull request #343 from discordextremelist/carolina-next
Browse files Browse the repository at this point in the history
Fix critical error page and improve db maxScore snake game logic
  • Loading branch information
carolinaisslaying authored Mar 2, 2025
2 parents b65de6e + 4c722d3 commit a6433d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 3 additions & 12 deletions src/Routes/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -669,20 +669,11 @@ router.post(
"Posted score is lower or equal to the user's current high score - no changes were made"
});

const user: delUser = await global.db
.collection<delUser>("users")
.findOne({ _id: req.user.id });
const score = user.game.snakes.maxScore + 1;

await global.db.collection("users").updateOne(
{ _id: req.user.id },
{
$set: {
game: {
snakes: {
maxScore: score
}
}
$inc: {
"game.snakes.maxScore": 1
}
}
);
Expand All @@ -704,7 +695,7 @@ router.post(
new: {
game: {
snakes: {
maxScore: score
maxScore: req.user.db.game.snakes.maxScore + 1
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion views/error.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
integrations: [
Sentry.replayIntegration(),
],
release: "website@<%= del.version %>",
<% if (del) { %>release: "website@<%= del.version %>",<% } %>
// Session Replay
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
Expand Down

0 comments on commit a6433d9

Please sign in to comment.