fix(exams): fix form validation wrt non-empty statements

This commit is contained in:
Sarah Vaupel 2021-06-11 12:20:43 +02:00 committed by Gregor Kleen
parent bf7b25ca9e
commit 0082135c56

View File

@ -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
guardValidation MsgExamAuthorshipStatementMustMatchSchoolDefinition $ not schoolSheetExamAuthorshipStatementAllowOther && Just statementContent == (authorshipStatementDefinitionContent . entityVal <$> mSchoolAuthorshipStatement)
unless (has (_Just . _entityVal . _examStaff . _Nothing) oldExam) $