From 1c24b8e5e2fe2e7807f15296de5de2072159d561 Mon Sep 17 00:00:00 2001 From: Wolfgang Witt Date: Wed, 10 Mar 2021 15:31:08 +0100 Subject: [PATCH] chore: display unrestricted rooms as "-" --- src/Handler/Exam/AutoOccurrence.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Handler/Exam/AutoOccurrence.hs b/src/Handler/Exam/AutoOccurrence.hs index 2715da603..28e5e0d4f 100644 --- a/src/Handler/Exam/AutoOccurrence.hs +++ b/src/Handler/Exam/AutoOccurrence.hs @@ -113,7 +113,7 @@ postEAutoOccurrenceR tid ssh csh examn = do let participants' = Map.fromList $ do (Entity uid userRec, Entity _ ExamRegistration{..}) <- participants return (uid, (userRec, examRegistrationOccurrence)) - occurrences' = Map.fromList $ map (\(Entity eoId ExamOccurrence{..}) -> (eoId, fromIntegral examOccurrenceCapacity)) occurrences + occurrences' = Map.fromList $ map (\(Entity eoId ExamOccurrence{..}) -> (eoId, view (from _examOccurrenceCapacityIso) $ fromIntegral <$> examOccurrenceCapacity)) occurrences autoOccurrenceResult = examAutoOccurrence eId examOccurrenceRule eaofConfig occurrences' participants' (eaofMapping, eaofAssignment) <- case autoOccurrenceResult of (Left e) -> do @@ -165,8 +165,10 @@ postEAutoOccurrenceR tid ssh csh examn = do occMappingRule = examOccurrenceMappingRule eaofMapping loadProp curr max' - | max' /= 0 = MsgProportion (toMessage curr) (toMessage max') (toRational curr / toRational max') - | otherwise = MsgProportionNoRatio (toMessage curr) (toMessage max') + | Just max'' <- max', max'' /= 0 + = MsgProportion (toMessage curr) (toMessage max'') (toRational curr / toRational max'') + | otherwise + = MsgProportionNoRatio (toMessage curr) $ maybe "-" toMessage max' occMapping occId = examOccurrenceMappingDescriptionWidget occMappingRule <$> Map.lookup occId (examOccurrenceMappingMapping eaofMapping) in $(widgetFile "widgets/exam-occurrence-mapping")