From d7366652bf4bdf97089e55479eb05d5658568d78 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel <> Date: Fri, 18 Sep 2020 12:11:44 +0200 Subject: [PATCH] fix(schedule): ignore FormFailures for now --- src/Handler/Schedule.hs | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/Handler/Schedule.hs b/src/Handler/Schedule.hs index 65502d92c..27fc3d3f6 100644 --- a/src/Handler/Schedule.hs +++ b/src/Handler/Schedule.hs @@ -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