diff --git a/client/src/pages/course/student/cross-check-review.tsx b/client/src/pages/course/student/cross-check-review.tsx index 4aa5c04800..f23acb337c 100644 --- a/client/src/pages/course/student/cross-check-review.tsx +++ b/client/src/pages/course/student/cross-check-review.tsx @@ -140,6 +140,10 @@ function Page() { const submitReview = withLoading(async values => { try { + if (values.maxScore != null && values.maxScore < score) { + message.error(`The score (${score}) exceeds the maximum score (${values.maxScore}) for the task.`); + return; + } await courseService.postTaskSolutionResult(values.githubId, values.courseTaskId, { score, comment: markdownLabel + values.comment, diff --git a/server/src/routes/course/crossCheck/createResult.ts b/server/src/routes/course/crossCheck/createResult.ts index 46d3178ce4..4196fca377 100644 --- a/server/src/routes/course/crossCheck/createResult.ts +++ b/server/src/routes/course/crossCheck/createResult.ts @@ -62,6 +62,11 @@ export const createResult = (_: ILogger) => async (ctx: Router.RouterContext) => review: Array.isArray(inputData.review) ? inputData.review : [], }; + if (data.score > courseTask.maxScore) { + setErrorResponse(ctx, BAD_REQUEST, 'score provided is greater than max score for the task'); + return; + } + if (isNaN(data.score) || data.score < 0) { setErrorResponse(ctx, BAD_REQUEST, 'no score provided'); return;