From b294b1cfc4bab4b5ec5247d37097873748759727 Mon Sep 17 00:00:00 2001 From: Luca Maio Date: Wed, 9 Feb 2022 11:34:09 +0100 Subject: [PATCH] fix(exams): exam results of non-registered users now show correctly --- src/Handler/ExamOffice/Exam.hs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Handler/ExamOffice/Exam.hs b/src/Handler/ExamOffice/Exam.hs index cde8a0015..69a32fd3f 100644 --- a/src/Handler/ExamOffice/Exam.hs +++ b/src/Handler/ExamOffice/Exam.hs @@ -293,9 +293,15 @@ postEGradesR tid ssh csh examn = do isSynced <- view . queryIsSynced $ E.val uid lift $ do - E.on $ courseParticipant E.?. CourseParticipantCourse E.==. E.just (E.val examCourse) - E.&&. courseParticipant E.?. CourseParticipantUser E.==. E.just (user E.^. UserId) - E.&&. courseParticipant E.?. CourseParticipantState E.==. E.just (E.val CourseParticipantActive) + E.on $ E.maybe E.true (\cCourse -> + cCourse E.==. E.val examCourse + ) (courseParticipant E.?. CourseParticipantCourse) + E.&&. E.maybe E.true (\cUser -> + cUser E.==. user E.^. UserId + ) (courseParticipant E.?. CourseParticipantUser) + E.&&. E.maybe E.true (\cState -> + cState E.==. E.val CourseParticipantActive + ) (courseParticipant E.?. CourseParticipantState) E.on $ occurrence E.?. ExamOccurrenceExam E.==. E.just (E.val eid) E.&&. occurrence E.?. ExamOccurrenceId E.==. E.joinV (examRegistration E.?. ExamRegistrationOccurrence) E.on $ examRegistration E.?. ExamRegistrationUser E.==. E.just (user E.^. UserId)