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)