fix(schedule): ignore FormFailures for now

This commit is contained in:
Sarah Vaupel 2020-09-18 12:11:44 +02:00
parent 4316606743
commit d7366652bf

View File

@ -46,16 +46,18 @@ postScheduleR = do
, fsAttrs = if sView == currentScheduleView then [("disabled","")] else mempty
}) Nothing
viewRes <- if
| Just errs <- fromNullable (filter (is _FormFailure) viewRess) -> do
mapM_ formFailure2Alerts errs
$logInfoS "SCHEDULE-VIEW" $ "encountered error(s): " <> tshow errs
(return . FormFailure . mconcat . catMaybes . (fmap $ preview _FormFailure) . toNullable) errs
| otherwise -> case catMaybes $ catMaybes (formResultToMaybe <$> viewRess) of -- TODO: rethink this case
-- TODO: ignoring FormFailures for now
-- | Just errs <- fromNullable (filter (is _FormFailure) viewRess) -> do
-- mapM_ formFailure2Alerts errs
-- $logInfoS "SCHEDULE-VIEW" $ "encountered error(s): " <> tshow errs
-- (return . FormFailure . mconcat . catMaybes . (fmap $ preview _FormFailure) . toNullable) errs
| otherwise -> case catMaybes $ catMaybes (formResultToMaybe <$> viewRess) of
[sView] -> do
$logInfoS "SCHEDULE-VIEW" $ "encountered single view result: " <> tshow sView <> ", all results: " <> tshow viewRess
return $ FormSuccess sView
_ -> do
$logInfoS "SCHEDULE-VIEW" $ "encountered no view, all results: " <> tshow viewRess
$logInfoS "SCHEDULE-VIEW" $ "currentScheduleView: " <> tshow currentScheduleView
return $ FormSuccess currentScheduleView
let
@ -69,16 +71,19 @@ postScheduleR = do
}) Nothing
offsetRes <- if
| Just errs <- fromNullable (filter (is _FormFailure) offsetRess) -> do
mapM_ formFailure2Alerts errs
$logInfoS "SCHEDULE-OFFSET" $ "encountered error(s): " <> tshow errs
(return . FormFailure . mconcat . catMaybes . (fmap $ preview _FormFailure) . toNullable) errs
| otherwise -> case catMaybes $ catMaybes (formResultToMaybe <$> offsetRess) of -- TODO: rethink this case
-- TODO: ignoring FormFailures for now
-- | Just errs <- fromNullable (filter (is _FormFailure) offsetRess) -> do
-- mapM_ formFailure2Alerts errs
-- $logInfoS "SCHEDULE-OFFSET" $ "encountered error(s): " <> tshow errs
-- (return . FormFailure . mconcat . catMaybes . (fmap $ preview _FormFailure) . toNullable) errs
| otherwise -> case catMaybes $ catMaybes (formResultToMaybe <$> offsetRess) of
[offset] -> do
$logInfoS "SCHEDULE-OFFSET" $ "encountered single offset result: " <> tshow offset <> ", all results: " <> tshow offsetRess
$logInfoS "SCHEDULE-OFFSET" $ "currentScheduleOffset: " <> tshow currentScheduleOffset
(return . FormSuccess . addOffset currentScheduleOffset . schedBtnOffset) offset
_ -> do
$logInfoS "SCHEDULE-OFFSET" $ "encountered no offset result, all results: " <> tshow offsetRess
$logInfoS "SCHEDULE-OFFSET" $ "currentScheduleOffset: " <> tshow currentScheduleOffset
return $ FormSuccess currentScheduleOffset
let