fix(course-visibility): correctly count courses on AllocationListR

This commit is contained in:
Sarah Vaupel 2020-08-02 17:49:01 +02:00
parent a16eb1ab91
commit 7530287788

View File

@ -33,7 +33,19 @@ countCourses muid ata now addWhere allocation = E.subSelectCount . E.from $ \all
E.where_ $ allocationCourse E.^. AllocationCourseAllocation E.==. allocation E.^. AllocationId
E.&&. E.exists (E.from $ \course -> E.where_ $
course E.^. CourseId E.==. allocationCourse E.^. AllocationCourseCourse
E.&&. mayViewCourse' muid ata now course
E.&&. (mayViewCourse' muid ata now course
E.||. E.exists (E.from $ \courseApplication -> E.where_ $
courseApplication E.^. CourseApplicationCourse E.==. course E.^. CourseId
E.&&. E.just (courseApplication E.^. CourseApplicationUser) E.==. E.val muid
E.&&. courseApplication E.^. CourseApplicationAllocation E.==. E.just (allocation E.^. AllocationId)
)
E.||. (E.isJust (allocation E.^. AllocationRegisterFrom)
E.&&. allocation E.^. AllocationRegisterFrom E.<=. E.val (Just now)
E.&&. (E.isNothing (allocation E.^. AllocationRegisterTo)
E.||. E.val (Just now) E.<=. allocation E.^. AllocationRegisterTo
)
)
)
)
E.&&. addWhere allocationCourse