refactor(course-visibility): remove unnecessary allocation checks
This commit is contained in:
parent
99c810b82e
commit
a7abe1231a
@ -34,7 +34,7 @@ getAShowR tid ssh ash = do
|
||||
resultCourseVisible = _5 . _Value
|
||||
|
||||
(Entity aId Allocation{..}, School{..}, isAnyLecturer, courses, registration) <- runDB $ do
|
||||
alloc@(Entity aId Allocation{allocationSchool,allocationRegisterFrom,allocationRegisterTo}) <- getBy404 $ TermSchoolAllocationShort tid ssh ash
|
||||
alloc@(Entity aId Allocation{allocationSchool}) <- getBy404 $ TermSchoolAllocationShort tid ssh ash
|
||||
school <- getJust allocationSchool
|
||||
|
||||
courses <- E.select . E.from $ \((allocationCourse `E.InnerJoin` course) `E.LeftOuterJoin` courseApplication `E.LeftOuterJoin` registration) -> do
|
||||
@ -46,14 +46,8 @@ getAShowR tid ssh ash = do
|
||||
E.&&. courseApplication E.?. CourseApplicationAllocation E.==. E.just (E.just $ E.val aId)
|
||||
E.on $ allocationCourse E.^. AllocationCourseCourse E.==. course E.^. CourseId
|
||||
E.where_ $ allocationCourse E.^. AllocationCourseAllocation E.==. E.val aId
|
||||
E.&&. (mayViewCourse muid ata now course (Just $ E.val aId)
|
||||
E.||. E.isJust (courseApplication E.?. CourseApplicationId)
|
||||
E.||. (E.isJust (E.val allocationRegisterFrom)
|
||||
E.&&. E.val allocationRegisterFrom E.<=. E.val (Just now)
|
||||
E.&&. (E.isNothing (E.val allocationRegisterTo)
|
||||
E.||. E.val (Just now) E.<=. E.val allocationRegisterTo
|
||||
)
|
||||
)
|
||||
E.&&. ( E.isJust (courseApplication E.?. CourseApplicationId)
|
||||
E.||. mayViewCourse muid ata now course (Just $ E.val aId)
|
||||
)
|
||||
E.orderBy [E.asc $ course E.^. CourseName]
|
||||
let hasTemplate = E.exists . E.from $ \courseAppInstructionFile ->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user