Skip to content

Commit

Permalink
Merge branch 'master' into tapeRTL
Browse files Browse the repository at this point in the history
  • Loading branch information
NadAlaba committed Sep 10, 2024
2 parents 3949466 + f6a27b2 commit 921788c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions backend/src/api/controllers/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ export async function addResult(
throw new MonkeyError(status.code, status.message);
}

if (user.lbOptOut !== true && completedEvent.acc < 75) {
throw new MonkeyError(400, "Accuracy too low");
}

const resulthash = completedEvent.hash;
if (req.ctx.configuration.results.objectHashCheckEnabled) {
const objectToHash = omit(completedEvent, "hash");
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"release-dry": "monkeytype-release --dry",
"hotfix-fe": "npm run build-fe && cd frontend && npm run deploy-live && monkeytype-purge",
"hotfix-be": "monkeytype-deploy-be",
"hotfix": "npm run hotfix-be && npm run hotfix-fe",
"pretty-check": "prettier --check .",
"pretty-check-be": "prettier --check ./backend",
"pretty-check-fe": "prettier --check ./frontend/src",
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/src/schemas/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ResultBaseSchema = z.object({
wpm: WpmSchema,
rawWpm: WpmSchema,
charStats: CharStatsSchema,
acc: PercentageSchema.min(75),
acc: PercentageSchema.min(50),
mode: ModeSchema,
mode2: Mode2Schema,
quoteLength: z.number().int().nonnegative().max(3).optional(),
Expand Down

0 comments on commit 921788c

Please sign in to comment.