fixed moodle logic
This commit is contained in:
@@ -25,7 +25,6 @@ router.post("/handle-participant-finished", async (req, res) => {
|
||||
},
|
||||
},
|
||||
});
|
||||
console.log("Handeling Participant-completed", participant?.User.publicId);
|
||||
if (!participant) {
|
||||
res.status(404).json({ error: "Participant not found" });
|
||||
return;
|
||||
@@ -62,11 +61,16 @@ router.post("/check-moodle-results", async (req, res) => {
|
||||
res.status(400).json({ error: "Teilnehmer hat keine Moodle-ID" });
|
||||
return;
|
||||
}
|
||||
const quizzResult = await getMoodleCourseCompletionStatus(
|
||||
const courseStatus = await getMoodleCourseCompletionStatus(
|
||||
participant.User.moodleId.toString(),
|
||||
participant.Event.finisherMoodleCourseId!,
|
||||
);
|
||||
if (quizzResult?.completionstatus?.completed === true) {
|
||||
|
||||
if (courseStatus?.completionstatus?.completed === true) {
|
||||
prisma.participant.update({
|
||||
where: { id: participant.id },
|
||||
data: { finisherMoodleCurseCompleted: true },
|
||||
});
|
||||
await handleParticipantFinished(participant.Event, participant, participant.User);
|
||||
res
|
||||
.status(200)
|
||||
|
||||
Reference in New Issue
Block a user