refactor: fix hlint

This commit is contained in:
Gregor Kleen 2019-07-26 12:06:13 +02:00
parent 7d3fa173b6
commit 062361dc8a
4 changed files with 8 additions and 8 deletions

View File

@ -93,23 +93,23 @@ postEAddUserR tid ssh csh examn = do
-- register known users
execWriterT $ mapM (registerUser examCourse eid registerCourse occId) uids
when (not $ null emails) $
unless (null emails) $
tell . pure <=< messageI Success . MsgExamParticipantsInvited $ length emails
when (not $ null alreadyRegistered) $
unless (null alreadyRegistered) $
tell . pure <=< messageI Success . MsgExamRegistrationParticipantsRegistered $ length registeredOneField
when (not $ null registeredNoField) $ do
unless (null registeredNoField) $ do
let modalTrigger = [whamlet|_{MsgExamRegistrationRegisteredWithoutField (length registeredNoField)}|]
modalContent = $(widgetFile "messages/examRegistrationInvitationRegisteredWithoutField")
tell . pure <=< messageWidget Warning $ msgModal modalTrigger (Right modalContent)
when (not $ null noCourseRegistration) $ do
unless (null noCourseRegistration) $ do
let modalTrigger = [whamlet|_{MsgExamRegistrationNotRegisteredWithoutCourse (length noCourseRegistration)}|]
modalContent = $(widgetFile "messages/examRegistrationInvitationNotRegisteredWithoutCourse")
tell . pure <=< messageWidget Error $ msgModal modalTrigger (Right modalContent)
when (not $ null registeredOneField) $
unless (null registeredOneField) $
tell . pure <=< messageI Success . MsgExamRegistrationAndCourseParticipantsRegistered $ length registeredOneField
registerUser :: CourseId -> ExamId -> Bool -> Maybe ExamOccurrenceId -> UserId -> WriterT AddRecipientsResult (YesodJobDB UniWorX) ()

View File

@ -81,7 +81,7 @@ examRegistrationInvitationConfig = InvitationConfig{..}
| otherwise
= Nothing
itStartsAt = Nothing
return $ InvitationTokenConfig{..}
return InvitationTokenConfig{..}
invitationRestriction _ _ = return Authorized
invitationForm (Entity _ Exam{..}) (InvDBDataExamRegistration{..}, _) uid = hoistAForm liftHandlerT . wFormToAForm $ do
isRegistered <- fmap (is _Just) . liftHandlerT . runDB . getBy $ UniqueParticipant uid examCourse

View File

@ -51,7 +51,7 @@ getEShowR tid ssh csh examn = do
let
registered
| Just uid <- mUid
= E.exists . E.from $ \examRegistration -> do
= E.exists . E.from $ \examRegistration ->
E.where_ $ examRegistration E.^. ExamRegistrationExam E.==. E.val eId
E.&&. examRegistration E.^. ExamRegistrationUser E.==. E.val uid
E.&&. examRegistration E.^. ExamRegistrationOccurrence E.==. E.just (examOccurrence E.^. ExamOccurrenceId)

View File

@ -518,7 +518,7 @@ postEUsersR tid ssh csh examn = do
E.where_ $ courseParticipant E.^. CourseParticipantCourse E.==. E.val examCourse
E.&&. courseParticipant E.^. CourseParticipantUser E.==. user E.^. UserId
E.limit 2
return $ (isCourseParticipant, user E.^. UserId)
return (isCourseParticipant, user E.^. UserId)
case users of
(filter . view $ _1 . _Value -> [(E.Value isPart, E.Value uid)])
-> return (isPart, uid)