refactor(exams): add FIXME markers (exam form still broken)

This commit is contained in:
Sarah Vaupel 2021-06-11 13:08:14 +02:00 committed by Gregor Kleen
parent fe78377fae
commit 1e87aa2dfe

View File

@ -169,7 +169,7 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
( case schoolSheetExamAuthorshipStatementMode of
SchoolAuthorshipStatementModeNone -> Just False
SchoolAuthorshipStatementModeOptional -> (is _Just . efAuthorshipStatement <$> template) <|> (pure $ is _Just schoolSheetExamAuthorshipStatementDefinition)
SchoolAuthorshipStatementModeRequired -> Just True
SchoolAuthorshipStatementModeRequired -> Just True -- FIXME: checkbox is unticked after form submit with school defaults (e.g. required, school definition given and unchanged)
)
officeSchoolsForm :: Maybe (Set SchoolId) -> AForm Handler (Set SchoolId)
@ -564,7 +564,7 @@ validateExam cId oldExam = do
_otherwise -> return ()
whenIsJust efAuthorshipStatement $ \statementContent -> do
mSchoolAuthorshipStatement <- lift $ maybe (pure Nothing) getEntity schoolSheetExamAuthorshipStatementDefinition
guardValidation MsgExamAuthorshipStatementMustBeNonEmpty $ schoolSheetExamAuthorshipStatementMode /= SchoolAuthorshipStatementModeRequired || statementContent /= mempty
guardValidation MsgExamAuthorshipStatementMustBeNonEmpty $ schoolSheetExamAuthorshipStatementMode /= SchoolAuthorshipStatementModeRequired || statementContent /= mempty -- FIXME: form validation fails in required mode with non-empty school default
guardValidation MsgExamAuthorshipStatementMustMatchSchoolDefinition $ not schoolSheetExamAuthorshipStatementAllowOther && Just statementContent == (authorshipStatementDefinitionContent . entityVal <$> mSchoolAuthorshipStatement)
unless (has (_Just . _entityVal . _examStaff . _Nothing) oldExam) $