Revert "Course Capacity is verified now, in CRegister Handler that also checks secret"

This reverts commit 9fc50e8736.
This commit is contained in:
Gregor Kleen 2018-07-08 10:31:41 +02:00
parent 8f9ddd1137
commit d60ef89bca

View File

@ -142,14 +142,7 @@ postCRegisterR tid csh = do
addMessage "info" "Sie wurden abgemeldet."
| codeOk -> do
actTime <- liftIO $ getCurrentTime
regOk <- runDB $ do
reg <- count [CourseParticipantCourse ==. cid]
if NTop (Just $ fromIntegral reg) < NTop (courseCapacity course)
then -- current capacity has room
insertUnique $ CourseParticipant cid aid actTime
else do -- no space left
addMessageI "danger" MsgCourseNoCapacity
return Nothing
regOk <- runDB $ insertUnique $ CourseParticipant cid aid actTime
when (isJust regOk) $ addMessage "success" "Erfolgreich angemeldet!"
| otherwise -> addMessage "danger" "Falsches Kennwort!"
(_other) -> return () -- TODO check this!