From 4282af893d0a3fb7b30f41b99b77e3d9abc5fca2 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel <> Date: Mon, 9 Nov 2020 20:42:07 +0100 Subject: [PATCH] fix(schedule): treat exam occurrences independently from course schedule opts --- src/Utils/Schedule.hs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/Utils/Schedule.hs b/src/Utils/Schedule.hs index 57caa7d64..691f43c91 100644 --- a/src/Utils/Schedule.hs +++ b/src/Utils/Schedule.hs @@ -90,16 +90,12 @@ examOccurrenceShouldBeDisplayed muid@(Just uid) ata now course exam examOcc = E. return $ examOccScheduleOpt E.^. ExamOccurrenceScheduleOptOpt mCourseOpt = E.subSelect $ getCourseScheduleOpt course user - - --_hasExamOccurrenceDisplayOptIn examOccurrence = E.exists . E.from $ \examOccurrenceScheduleOpt -> E.where_ $ - -- examOccurrenceScheduleOpt E.^. ExamOccurrenceScheduleOptExamOccurrence E.==. examOccurrence E.^. ExamOccurrenceId - -- E.&&. E.just (examOccurrenceScheduleOpt E.^. ExamOccurrenceScheduleOptUser) E.==. E.val muid - -- E.&&. examOccurrenceScheduleOpt E.^. ExamOccurrenceScheduleOptOpt in E.where_ $ user E.^. UserId E.==. E.val uid E.&&. E.fromMaybe - ( E.fromMaybe - ( user E.^. UserScheduleOccurrenceDisplayDefault - E.&&. ( isCourseLecturer muid ata (course E.^. CourseId) + ( ( E.fromMaybe + (user E.^. UserScheduleOccurrenceDisplayDefault) + mCourseOpt + ) E.&&. ( isCourseLecturer muid ata (course E.^. CourseId) E.||. ( mayViewCourse muid ata now course Nothing -- do NOT remove, this is actually necessary here! -- (There can be exam participants that are -- not enrolled, me thinks) @@ -111,9 +107,7 @@ examOccurrenceShouldBeDisplayed muid@(Just uid) ata now course exam examOcc = E. E.&&. E.maybe E.true (\registrationOccurrence -> E.maybe E.false (const E.true) mExamOccOpt E.||. registrationOccurrence E.==. examOcc E.^. ExamOccurrenceId) (examRegistration E.^. ExamRegistrationOccurrence) -- if registered for a specific occurrence, get only this one and occurrences with an opt-in, otherwise get every occurrence available ) ) - ) ) - mCourseOpt ) mExamOccOpt examOccurrenceShouldBeDisplayed _ _ _ _ _ _ = E.false