minor refactor

This commit is contained in:
Steffen Jost 2019-06-06 10:09:35 +02:00
parent 59d5f441c8
commit ee7f2b534a

View File

@ -1062,17 +1062,13 @@ assignHandler tid ssh csh rawSids = do
-- process form -- process form
currentRoute <- getCurrentRoute currentRoute <- getCurrentRoute
((btnResult, btnWdgt), btnEnctype) <- runFormPost $ identifyForm FIDAssignSubmissions buttonForm ((btnResult, btnWdgt), btnEnctype) <- runFormPost $ identifyForm FIDAssignSubmissions buttonForm
assignmentStatus <- case btnResult of assignmentStatus <- fmap (fromMaybe Map.empty) . formResultMaybe btnResult $ \BtnSubmissionsAssign ->
FormSuccess BtnSubmissionsAssign -> do -- Button was pressed, assign and report -- Assign submissions
-- Assign submissions fmap Just . runDB $ (\f -> foldM f Map.empty sids) $
runDB $ (\f -> foldM f Map.empty sids) $ \acc sid -> flip (Map.insert sid) acc <$> assignSubmissions sid Nothing
\acc sid -> flip (Map.insert sid) acc <$> assignSubmissions sid Nothing -- Too much important information for an alert message. Display proper info page instead
-- Too much important information for an alert. Display proper info page instead
other -> do
formFailure2Alerts other -- show possible allerts
return Map.empty -- no assignments performed
let btnForm = wrapForm btnWdgt def let btnForm = wrapForm btnWdgt def
{ formAction = SomeRoute <$> currentRoute { formAction = SomeRoute <$> currentRoute -- TODO: should be a modal route
, formEncoding = btnEnctype , formEncoding = btnEnctype
, formSubmit = FormNoSubmit , formSubmit = FormNoSubmit
} }