From 2d921ba20bc41ce2a5b29d6d1f3a1e45cba2cb05 Mon Sep 17 00:00:00 2001 From: Sarah Vaupel <> Date: Thu, 3 Sep 2020 20:49:35 +0200 Subject: [PATCH] fix(schedule): return FormFailure --- src/Handler/Schedule.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Handler/Schedule.hs b/src/Handler/Schedule.hs index 2e43fd65c..2b81be7e1 100644 --- a/src/Handler/Schedule.hs +++ b/src/Handler/Schedule.hs @@ -15,6 +15,7 @@ getScheduleR = postScheduleR postScheduleR = do uid <- requireAuthId + -- TODO: local instead of global get params? mView <- lookupGlobalGetParam GetScheduleView mOffset <- lookupGlobalGetParam GetScheduleOffset @@ -48,7 +49,7 @@ postScheduleR = do | Just errs <- fromNullable (filter (is _FormFailure) viewRess) -> do mapM_ formFailure2Alerts errs $logInfoS "SCHEDULE-VIEW" $ "encountered error(s): " <> tshow errs - return FormMissing -- TODO: return FormFailure + (return . FormFailure . mconcat . catMaybes . (fmap $ preview _FormFailure) . toNullable) errs | otherwise -> case catMaybes (formResultToMaybe <$> viewRess) of -- TODO: rethink this case [sView] -> do $logInfoS "SCHEDULE-VIEW" $ "encountered single view result: " <> tshow sView <> ", all results: " <> tshow viewRess @@ -71,7 +72,7 @@ postScheduleR = do | Just errs <- fromNullable (filter (is _FormFailure) offsetRess) -> do mapM_ formFailure2Alerts errs $logInfoS "SCHEDULE-OFFSET" $ "encountered error(s): " <> tshow errs - return FormMissing -- TODO: return FormFailure + (return . FormFailure . mconcat . catMaybes . (fmap $ preview _FormFailure) . toNullable) errs | otherwise -> case catMaybes (formResultToMaybe <$> offsetRess) of -- TODO: rethink this case [offset] -> do $logInfoS "SCHEDULE-OFFSET" $ "encountered single offset result: " <> tshow offset <> ", all results: " <> tshow offsetRess