From 5bff34ed0a1b2d4d160c506cbe7090209d28da66 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 30 Jan 2020 08:31:52 +0100 Subject: [PATCH] fix: non-exhaustive patterns --- src/Handler/Exam/Show.hs | 2 +- src/Handler/Utils/Exam.hs | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Handler/Exam/Show.hs b/src/Handler/Exam/Show.hs index 50c2c1fb2..e1bec059e 100644 --- a/src/Handler/Exam/Show.hs +++ b/src/Handler/Exam/Show.hs @@ -83,7 +83,7 @@ getEShowR tid ssh csh examn = do showCloseWidget = lecturerInfoShown showAutoOccurrenceCalculateWidget = lecturerInfoShown - sumMaxPoints = sum [ fromRational examPartWeight * mPoints | Entity _ ExamPart{..} <- examParts, let Just mPoints = examPartMaxPoints ] + sumMaxPoints = sum [ fromRational examPartWeight * mPoints | Entity _ ExamPart{..} <- examParts, mPoints <- examPartMaxPoints ^.. _Just ] noBonus = fromMaybe False $ do guardM $ bonusOnlyPassed <$> examBonusRule diff --git a/src/Handler/Utils/Exam.hs b/src/Handler/Utils/Exam.hs index a7188cb0f..612ce4aad 100644 --- a/src/Handler/Utils/Exam.hs +++ b/src/Handler/Utils/Exam.hs @@ -249,8 +249,7 @@ examAutoOccurrence (hash -> seed) rule ExamAutoOccurrenceConfig{..} occurrences = Map.fromListWith Set.union [ (map CI.mk $ unpack matriculation', Set.singleton uid) | (uid, (User{..}, Nothing)) <- Map.toList users - , let Just matriculation' = userMatrikelnummer - , not $ null matriculation' + , matriculation' <- userMatrikelnummer ^.. _Just . filtered (not . null) ] in Map.mapKeysWith Set.union (take . F.minimum . Set.map length $ Map.keysSet matrUsers) matrUsers _ -> Map.singleton [] $ Map.keysSet users