diff --git a/src/Utils/Course.hs b/src/Utils/Course.hs index fe2d40aff..ce56d4220 100644 --- a/src/Utils/Course.hs +++ b/src/Utils/Course.hs @@ -95,11 +95,11 @@ isCourseExamCorrector muid AuthTagActive{..} cid = E.exists . E.from $ \(examCor E.&&. E.val (authTagIsActive AuthExamCorrector) isCourseParticipant :: Maybe UserId -> AuthTagActive -> E.SqlExpr (E.Value CourseId) -> E.SqlExpr (E.Value Bool) -isCourseParticipant muid AuthTagActive{..} cid = E.exists . E.from $ \courseParticipant -> do - E.where_ $ E.just (courseParticipant E.^. CourseParticipantUser) E.==. E.val muid - E.&&. courseParticipant E.^. CourseParticipantCourse E.==. cid - E.&&. courseParticipant E.^. CourseParticipantState E.==. E.val CourseParticipantActive - E.&&. E.val (authTagIsActive AuthCourseRegistered) -- TODO is this the auth tag I want here? +isCourseParticipant muid AuthTagActive{..} cid = E.exists . E.from $ \courseParticipant -> E.where_ $ + E.just (courseParticipant E.^. CourseParticipantUser) E.==. E.val muid + E.&&. courseParticipant E.^. CourseParticipantCourse E.==. cid + E.&&. courseParticipant E.^. CourseParticipantState E.==. E.val CourseParticipantActive + E.&&. E.val (authTagIsActive AuthCourseRegistered) -- TODO is this the auth tag I want here? isCourseApplicant :: Maybe UserId -> AuthTagActive -> E.SqlExpr (E.Value CourseId) -> Maybe (E.SqlExpr (E.Value AllocationId)) -> E.SqlExpr (E.Value Bool) isCourseApplicant muid AuthTagActive{..} cid maid = E.exists . E.from $ \courseApplication -> E.where_ $