mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(api): update attempt with created moderation record (#64812)
This commit is contained in:
@@ -687,7 +687,7 @@ async function postExamAttemptHandler(
|
||||
: 'Unknown attempt validation error';
|
||||
logger.warn({ validExamAttemptError: message }, 'Invalid exam attempt.');
|
||||
// As attempt is invalid, create moderation record to investigate or update existing record
|
||||
await this.prisma.examEnvironmentExamModeration.upsert({
|
||||
const moderation = await this.prisma.examEnvironmentExamModeration.upsert({
|
||||
where: { examAttemptId: latestAttempt.id },
|
||||
create: {
|
||||
examAttemptId: latestAttempt.id,
|
||||
@@ -699,6 +699,17 @@ async function postExamAttemptHandler(
|
||||
}
|
||||
});
|
||||
|
||||
// Link attempt with moderation id if it has not already been done
|
||||
await this.prisma.examEnvironmentExamAttempt.update({
|
||||
where: {
|
||||
id: latestAttempt.id,
|
||||
examModerationId: null
|
||||
},
|
||||
data: {
|
||||
examModerationId: moderation.id
|
||||
}
|
||||
});
|
||||
|
||||
void reply.code(400);
|
||||
return reply.send(ERRORS.FCC_EINVAL_EXAM_ENVIRONMENT_EXAM_ATTEMPT(message));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user