fix(schedule): display opted-in exam occs without registration
This commit is contained in:
parent
2bbe67bf90
commit
c41e3b6bb3
@ -52,11 +52,16 @@ fetchExamOccurrences muid ata now = E.select $ E.from $ \(course `E.InnerJoin` e
|
||||
E.&&. (E.exists $ E.from $ \examRegistration -> E.where_ $
|
||||
examRegistration E.^. ExamRegistrationExam E.==. exam E.^. ExamId
|
||||
E.&&. E.just (examRegistration E.^. ExamRegistrationUser) E.==. E.val muid
|
||||
E.&&. E.maybe E.true (\registrationOccurrence -> registrationOccurrence E.==. examOccurrence E.^. ExamOccurrenceId) (examRegistration E.^. ExamRegistrationOccurrence) -- if registered for a specific occurrence, get only this one, otherwise get every occurrence available
|
||||
E.&&. E.maybe E.true (\registrationOccurrence -> hasExamOccurrenceDisplayOptIn examOccurrence E.||. registrationOccurrence E.==. examOccurrence 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
|
||||
)
|
||||
)
|
||||
)
|
||||
return (course, exam, examOccurrence)
|
||||
where
|
||||
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
|
||||
|
||||
|
||||
courseEventShouldBeDisplayed :: Maybe UserId -> E.SqlExpr (Entity Course) -> E.SqlExpr (Entity CourseEvent) -> E.SqlExpr (E.Value Bool)
|
||||
|
||||
Reference in New Issue
Block a user