Merge branch 'develop' into feature/updated-user-type-dashboard

This commit is contained in:
Tiago Ribeiro
2023-10-24 14:47:46 +01:00
3 changed files with 55 additions and 35 deletions

View File

@@ -46,6 +46,9 @@ export default function ExamPage({page}: Props) {
const router = useRouter();
useEffect(() => setSessionId(uuidv4()), []);
useEffect(() => {
console.log({userSolutions});
}, [userSolutions]);
useEffect(() => {
selectedModules.length > 0 && timeSpent === 0 && !showSolutions;
@@ -134,24 +137,22 @@ export default function ExamPage({page}: Props) {
Promise.all(
exam.exercises.map(async (exercise) => {
if (exercise.type === "writing")
return evaluateWritingAnswer(exercise, solutions.find((x) => x.exercise === exercise.id)!).then((response) => {
if (response) {
setUserSolutions([...userSolutions.filter((x) => x.exercise !== exercise.id), response]);
}
});
if (exercise.type === "writing") {
return await evaluateWritingAnswer(exercise, solutions.find((x) => x.exercise === exercise.id)!);
}
if (exercise.type === "interactiveSpeaking" || exercise.type === "speaking")
return evaluateSpeakingAnswer(exercise, solutions.find((x) => x.exercise === exercise.id)!).then((response) => {
if (response) {
setUserSolutions([...userSolutions.filter((x) => x.exercise !== exercise.id), response]);
}
});
if (exercise.type === "interactiveSpeaking" || exercise.type === "speaking") {
return await evaluateSpeakingAnswer(exercise, solutions.find((x) => x.exercise === exercise.id)!);
}
}),
).finally(() => {
setIsEvaluationLoading(false);
setHasBeenUploaded(false);
});
)
.then((responses) => {
setUserSolutions([...userSolutions, ...responses.filter((x) => !!x)] as any);
})
.finally(() => {
setIsEvaluationLoading(false);
setHasBeenUploaded(false);
});
}
axios.get("/api/stats/update");

View File

@@ -26,5 +26,9 @@ async function sendVerification(req: NextApiRequest, res: NextApiResponse) {
);
await transport.sendMail(mailOptions);
res.status(200).json({ok: true});
return;
}
res.status(404).json({ok: false});
}