fix(exams): remove deprecated/unnecessary form validation wrt. authship statements

This commit is contained in:
Sarah Vaupel 2021-06-19 10:20:50 +02:00 committed by Gregor Kleen
parent ac86832b34
commit bf059a1320

View File

@ -555,14 +555,5 @@ validateExam cId oldExam = do
warnValidation MsgExamModeSchoolDiscouraged . not $ evalExamModeDNF schoolExamDiscouragedModes efExamMode
case schoolSheetExamAuthorshipStatementMode of
SchoolAuthorshipStatementModeNone -> guardValidation MsgExamAuthorshipStatementMustBeEmpty $ is _Nothing efAuthorshipStatement
SchoolAuthorshipStatementModeRequired -> guardValidation MsgExamAuthorshipStatementMustBeNonEmpty $ is _Just efAuthorshipStatement
_otherwise -> return ()
whenIsJust efAuthorshipStatement $ \statementContent -> do
mSchoolAuthorshipStatement <- lift $ maybe (pure Nothing) getEntity schoolSheetExamAuthorshipStatementDefinition
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) $
guardValidation MsgExamStaffRequired $ isn't _Nothing efStaff