From 753028778833ea9972d37c973fe1f339512774e8 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel <> Date: Sun, 2 Aug 2020 17:49:01 +0200 Subject: [PATCH] fix(course-visibility): correctly count courses on AllocationListR --- src/Handler/Allocation/List.hs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Handler/Allocation/List.hs b/src/Handler/Allocation/List.hs index dd44d557c..de8753751 100644 --- a/src/Handler/Allocation/List.hs +++ b/src/Handler/Allocation/List.hs @@ -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