fix(schedule): treat exam occurrences independently from course schedule opts

This commit is contained in:
Sarah Vaupel 2020-11-09 20:42:07 +01:00
parent b0023dfa67
commit 4282af893d

View File

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