fix(course-visibility): allow for caching Nothing results of getBy

This commit is contained in:
Sarah Vaupel 2020-08-05 10:50:19 +02:00
parent 23aca1caa4
commit f129ce6b2b

View File

@ -989,7 +989,7 @@ tagAccessPredicate AuthAllocationTime = APDB $ \mAuthId route _ -> case route of
tagAccessPredicate AuthCourseTime = APDB $ \_mAuthId route _ -> case route of
CourseR tid ssh csh _ -> maybeT (unauthorizedI MsgUnauthorizedCourseTime) $ do
now <- liftIO getCurrentTime
Entity _cid course <- $cachedHereBinary (tid, ssh, csh) . MaybeT . getBy $ TermSchoolCourseShort tid ssh csh
Entity _cid course <- MaybeT . $cachedHereBinary (tid, ssh, csh) . getBy $ TermSchoolCourseShort tid ssh csh
guard $ courseIsVisible' now course
return Authorized
r -> $unsupportedAuthPredicate AuthCourseTime r