diff --git a/src/Handler/Exam/Show.hs b/src/Handler/Exam/Show.hs index 27c55a9b4..9ee2da005 100644 --- a/src/Handler/Exam/Show.hs +++ b/src/Handler/Exam/Show.hs @@ -72,11 +72,17 @@ getEShowR tid ssh csh examn = do examClosedShown = lecturerInfoShown sumMaxPoints = sum [ fromRational examPartWeight * mPoints | Entity _ ExamPart{..} <- examParts, let Just mPoints = examPartMaxPoints ] - sumPoints = getSum <$> foldMap (fmap Sum . examPartResultResult . entityVal) results noBonus = fromMaybe False $ do guardM $ bonusOnlyPassed <$> examBonusRule return . fromMaybe True $ result ^? _Just . _entityVal . _examResultResult . _examResult . passingGrade . _Wrapped . to not + + sumPoints = fmap getSum . mconcat $ catMaybes + [ Just $ foldMap (fmap Sum . examPartResultResult . entityVal) results + , guard (not noBonus) *> fmap (pure . Sum . examBonusBonus . entityVal) bonus + ] + + hasRegistration = any snd occurrences let examTimes = all (\(Entity _ ExamOccurrence{..}, _) -> Just examOccurrenceStart == examStart && examOccurrenceEnd == examEnd) occurrences diff --git a/src/Utils/Form.hs b/src/Utils/Form.hs index 1a7d32b74..31bc5ad08 100644 --- a/src/Utils/Form.hs +++ b/src/Utils/Form.hs @@ -328,7 +328,7 @@ combinedButtonField :: forall a m. ) => [a] -> FieldSettings (HandlerSite m) -> AForm m [Maybe a] combinedButtonField bs FieldSettings{..} = formToAForm $ do mr <- getMessageRender - fvId <- maybe newFormIdent return fsId + fvId <- maybe newIdent return fsId name <- maybe newFormIdent return fsName (ress, fvs) <- fmap unzip . for bs $ \b -> mopt (buttonField b) ("" { fsId = Just $ fvId <> "__" <> toPathPiece b , fsName = Just $ name <> "__" <> toPathPiece b diff --git a/templates/exam-show.hamlet b/templates/exam-show.hamlet index b05d2c2b6..44ff63632 100644 --- a/templates/exam-show.hamlet +++ b/templates/exam-show.hamlet @@ -114,7 +114,7 @@ $if not (null occurrences)