feat(exams): first do-nothing stub for exam-wide authorship statements

This commit is contained in:
Sarah Vaupel 2021-06-10 13:46:27 +02:00 committed by Gregor Kleen
parent 8bb61401a7
commit 0392297ddb
3 changed files with 61 additions and 22 deletions

View File

@ -322,4 +322,7 @@ ExamAuthorshipStatementSchoolDefinition: Institutsweit vorgegebene Eigenständig
ExamAuthorshipStatementUseCustomDefinition: Benutzerdefinierte Eigenständigkeitserklärung verwenden?
ExamAuthorshipStatementUseCustomDefinitionTip: Soll anstatt der institutsweit vorgegebenen Eigenständigkeitserklärung eine benuzterdefinierte Erklärung für diese Prüfung genutzt werden? (Hinweis: Um konsistente Erklärungen für alle Abgaben der Prüfung zu gewährleisten, dient die institutsweite Erklärung hier nur als Vorlage und wird ab dann getrennt (als Kopie) gespeichert. Ändert sich die institutsweite Erklärung, so muss die Änderung für diese Prüfung manuell übernommen werden, falls erwünscht.)
ExamAuthorshipStatementUseCustomDefinitionDisabledTip: Für dieses Institut ist die institutsweite Vorgabe als Erklärung zu verwenden. Benutzerdefinierte Erklärungen sind nicht gestattet.
ExamAuthorshipStatementCustom: Benutzerdefinierte Eigenständigkeitserklärung
ExamAuthorshipStatementCustom: Benutzerdefinierte Eigenständigkeitserklärung
ExamAuthorshipStatementContent: Eigenständigkeitserklärung
ExamAuthorshipStatementAllowOtherFalseTip: Für dieses Institut muss die institutsweit vorgegebene Eigenständigkeitserklärung verwendet werden. Benutzerdefinierte Erklärungen sind nicht gestattet.

View File

@ -320,4 +320,7 @@ ExamAuthorshipStatementSchoolDefinition: School-wide default Statement of Author
ExamAuthorshipStatementUseCustomDefinition: Use custom Statement of Authorship?
ExamAuthorshipStatementUseCustomDefinitionTip: Should a custom Statement of Authorship be used for this exam instead of the school-wide default statement? (Hint: To ensure consistent statements for all submissions related to this exam, the school-wide default statement will be used as a template here and will then be stored separately (as a copy). If the school-wide default statement changes, this change must be applied manually for this exam if desired.)
ExamAuthorshipStatementUseCustomDefinitionDisabledTip: This school dictates that the school-wide Statement of Authorship must be used. Custom statements are prohibited.
ExamAuthorshipStatementCustom: Custom Statement of Authorship
ExamAuthorshipStatementCustom: Custom Statement of Authorship
ExamAuthorshipStatementContent: Statement of Authorship
ExamAuthorshipStatementAllowOtherFalseTip: The settings of this school dictate that the school-wide Statement of Authorship must be used. Custom statements are prohibited.

View File

@ -52,6 +52,7 @@ data ExamForm = ExamForm
, efStaff :: Maybe Text
, efCorrectors :: Set (Either UserEmail UserId)
, efExamParts :: Set ExamPartForm
, efAuthorshipStatement :: Maybe StoredMarkup
}
data ExamOccurrenceForm = ExamOccurrenceForm
@ -148,29 +149,16 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
<*> examPartsForm (efExamParts <$> template)
-- TODO: refactor messages to be used across scopes, then define this form section separately (to be used for exams and sheets)
<* aformSection MsgExamAuthorshipStatementSection
<* optionalActionA
( aopt htmlField
(fslI MsgExamAuthorshipStatementSchoolDefinition & addAttr "disabled" "disabled")
((Just . authorshipStatementDefinitionContent . entityVal) <$> mSchoolAuthorshipStatement)
<* optionalActionA
( apreq htmlField
(fslI MsgExamAuthorshipStatementCustom)
(
-- TODO: load custom statement from template
-- (loading school definition as default is not necessary if it is displayed in form)
Nothing
)
)
<*> optionalActionA
( areq htmlField
( if schoolSheetExamAuthorshipStatementAllowOther
then fslI MsgExamAuthorshipStatementUseCustomDefinition
& setTooltip MsgExamAuthorshipStatementUseCustomDefinitionTip
else fslI MsgExamAuthorshipStatementUseCustomDefinition
then fslI MsgExamAuthorshipStatementContent
else fslI MsgExamAuthorshipStatementContent
& addAttr "disabled" "disabled"
& setTooltip MsgExamAuthorshipStatementUseCustomDefinitionDisabledTip
& setTooltip MsgExamAuthorshipStatementAllowOtherFalseTip
)
( bool (Just False)
(Just True) -- TODO: set according to template, if template is empty `Just True`
schoolSheetExamAuthorshipStatementAllowOther
( Nothing -- TODO: take value from template
<|> (authorshipStatementDefinitionContent . entityVal <$> mSchoolAuthorshipStatement)
)
)
( case schoolSheetExamAuthorshipStatementMode of
@ -183,6 +171,44 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
SchoolAuthorshipStatementModeOptional -> Nothing -- TODO: set value according to template
SchoolAuthorshipStatementModeRequired -> Just True
)
-- <*> optionalActionA
-- ( ( optionalActionA
-- ( areq htmlField
-- (fslI MsgExamAuthorshipStatementCustom)
-- (
-- -- TODO: load custom statement from template
-- -- (loading school definition as default is not necessary if it is displayed in form)
-- mempty
-- )
-- )
-- ( if schoolSheetExamAuthorshipStatementAllowOther
-- then fslI MsgExamAuthorshipStatementUseCustomDefinition
-- & setTooltip MsgExamAuthorshipStatementUseCustomDefinitionTip
-- else fslI MsgExamAuthorshipStatementUseCustomDefinition
-- & addAttr "disabled" "disabled"
-- & setTooltip MsgExamAuthorshipStatementUseCustomDefinitionDisabledTip
-- )
-- ( bool (Just False)
-- (Just True) -- TODO: set according to template, if template is empty `Just True`
-- schoolSheetExamAuthorshipStatementAllowOther
-- )
-- )
-- <*> ( aopt htmlField
-- (fslI MsgExamAuthorshipStatementSchoolDefinition & addAttr "disabled" "disabled")
-- ((Just . authorshipStatementDefinitionContent . entityVal) <$> mSchoolAuthorshipStatement)
-- )
-- )
-- ( case schoolSheetExamAuthorshipStatementMode of
-- SchoolAuthorshipStatementModeNone -> fslI MsgExamAuthorshipStatementRequired & addAttr "disabled" "disabled" & setTooltip MsgExamAuthorshipStatementRequiredDisabledOffTip
-- SchoolAuthorshipStatementModeOptional -> fslI MsgExamAuthorshipStatementRequired & setTooltip MsgExamAuthorshipStatementRequiredTip
-- SchoolAuthorshipStatementModeRequired -> fslI MsgExamAuthorshipStatementRequired & addAttr "disabled" "disabled" & setTooltip MsgExamAuthorshipStatementRequiredDisabledOnTip
-- )
-- ( case schoolSheetExamAuthorshipStatementMode of
-- SchoolAuthorshipStatementModeNone -> Just False
-- SchoolAuthorshipStatementModeOptional -> Nothing -- TODO: set value according to template
-- SchoolAuthorshipStatementModeRequired -> Just True
-- )
-- )
officeSchoolsForm :: Maybe (Set SchoolId) -> AForm Handler (Set SchoolId)
officeSchoolsForm mPrev = wFormToAForm $ do
@ -403,6 +429,7 @@ examFormTemplate (Entity eId Exam{..}) = do
, efExamMode = examExamMode
, efOfficeSchools = Set.fromList $ examOfficeSchoolSchool . entityVal <$> extraSchools
, efStaff = examStaff
, efAuthorshipStatement = Nothing -- TODO
}
examTemplate :: MonadHandler m
@ -455,6 +482,7 @@ examTemplate cid = runMaybeT $ do
, efExamMode = examExamMode oldExam
, efStaff = examStaff oldExam
, efOfficeSchools = Set.fromList $ examOfficeSchoolSchool . entityVal <$> extraSchools
, efAuthorshipStatement = Nothing -- TODO
}
@ -565,5 +593,10 @@ validateExam cId oldExam = do
warnValidation MsgExamModeSchoolDiscouraged . not $ evalExamModeDNF schoolExamDiscouragedModes efExamMode
-- TODO: form validation of examAuthorshipStatement wrt school settings
-- - if mode is none, the statement must be `Nothing`
-- - if mode is required, the statement must be `Just x`
-- - if the school has a definition and disallows other, the statement must match the school definition
unless (has (_Just . _entityVal . _examStaff . _Nothing) oldExam) $
guardValidation MsgExamStaffRequired $ isn't _Nothing efStaff