refactor(schedule): catMaybes

This commit is contained in:
Sarah Vaupel 2020-09-17 18:35:00 +02:00
parent 5da9a1499c
commit 3cf0188d2a

View File

@ -50,8 +50,8 @@ postScheduleR = do
mapM_ formFailure2Alerts errs
$logInfoS "SCHEDULE-VIEW" $ "encountered error(s): " <> tshow errs
(return . FormFailure . mconcat . catMaybes . (fmap $ preview _FormFailure) . toNullable) errs
| otherwise -> case catMaybes (formResultToMaybe <$> viewRess) of -- TODO: rethink this case
[Just sView] -> do
| otherwise -> case catMaybes $ catMaybes (formResultToMaybe <$> viewRess) of -- TODO: rethink this case
[sView] -> do
$logInfoS "SCHEDULE-VIEW" $ "encountered single view result: " <> tshow sView <> ", all results: " <> tshow viewRess
return $ FormSuccess sView
_ -> do
@ -73,8 +73,8 @@ postScheduleR = do
mapM_ formFailure2Alerts errs
$logInfoS "SCHEDULE-OFFSET" $ "encountered error(s): " <> tshow errs
(return . FormFailure . mconcat . catMaybes . (fmap $ preview _FormFailure) . toNullable) errs
| otherwise -> case catMaybes (formResultToMaybe <$> offsetRess) of -- TODO: rethink this case
[Just offset] -> do
| otherwise -> case catMaybes $ catMaybes (formResultToMaybe <$> offsetRess) of -- TODO: rethink this case
[offset] -> do
$logInfoS "SCHEDULE-OFFSET" $ "encountered single offset result: " <> tshow offset <> ", all results: " <> tshow offsetRess
(return . FormSuccess . addOffset currentScheduleOffset . schedBtnOffset) offset
_ -> do