Apply 1 suggestion(s) to 1 file(s)
This commit is contained in:
parent
fa75d805b0
commit
fcc5930a3c
@ -1506,7 +1506,9 @@ tagAccessPredicate AuthCapacity = APDB $ \_ _ _ route _ -> case route of
|
||||
Entity occId ExamOccurrence{..} <- $cachedHereBinary (eid, occn) . MaybeT . getBy $ UniqueExamOccurrence eid occn
|
||||
registered <- $cachedHereBinary occId . lift $ fromIntegral <$> count [ ExamRegistrationOccurrence ==. Just occId, ExamRegistrationExam ==. eid ]
|
||||
-- Nothing means unlimited size
|
||||
guard $ maybe True (> registered) examOccurrenceCapacity
|
||||
whenIsJust examOccurrenceCapacity $ \capacity ->
|
||||
registered <- $cachedHereBinary occId . lift $ fromIntegral <$> count [ ExamRegistrationOccurrence ==. Just occId, ExamRegistrationExam ==. eid ]
|
||||
guard $ capacity > registered
|
||||
return Authorized
|
||||
CTutorialR tid ssh csh tutn _ -> maybeT (unauthorizedI MsgTutorialNoCapacity) $ do
|
||||
cid <- $cachedHereBinary (tid, ssh, csh) . MaybeT . getKeyBy $ TermSchoolCourseShort tid ssh csh
|
||||
|
||||
Loading…
Reference in New Issue
Block a user