fix(exams): exam results of non-registered users now show correctly

This commit is contained in:
Luca Maio 2022-02-09 11:34:09 +01:00 committed by Sarah Vaupel
parent 2f2e201280
commit b294b1cfc4

View File

@ -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)