fix(sheets): fixhance sheet authship form section

This commit is contained in:
Sarah Vaupel 2021-06-19 12:31:14 +02:00 committed by Gregor Kleen
parent 491f7d3582
commit 7192cb527c
3 changed files with 25 additions and 26 deletions

View File

@ -157,4 +157,5 @@ SheetAuthorshipStatementRequired: Eigenständigkeitserklärung für Übungsblatt
SheetAuthorshipStatementRequiredTip: Sollen die Abgebenden (bei Abgabegruppen jedes Gruppenmitglied) aufgefordert werden, eine Eigenständigkeitserklärung zu akzeptieren?
SheetAuthorshipStatementRequiredForcedTip: Für dieses Institut sind Eigenständigkeitserklärungen für nicht-prüfungszugehörige Übungsblätter vorgeschrieben.
SheetAuthorshipStatementContent: Eigenständigkeitserklärung
SheetAuthorshipStatementContentForcedTip: Für dieses Institut ist die institutsweit vorgegebene Eigenständigkeitserklärung für nicht-prüfungszugehörige Übungsblätter zu verwenden. Benutzerdefinierte Erklärungen sind nicht gestattet.
SheetAuthorshipStatementContentOverridesExamTip: Gehört dieses Übungsblatt zu einer Prüfung mit einer prüfungsweit eingestellten Eigenständigkeitserklärung, so können Sie hier eine für dieses Übungsblatt abweichende Eigenständigkeitserklärung angeben.

View File

@ -156,4 +156,5 @@ SheetAuthorshipStatementRequired: Require Statement of Authorship for submission
SheetAuthorshipStatementRequiredTip: Should submittors (each group member in case of submission groups) be required to accept a Statement of Authorship?
SheetAuthorshipStatementRequiredForcedTip: This school enforces Statements of Authorship for all exam-unrelated exercise sheets.
SheetAuthorshipStatementContent: Statement of Authorship
SheetAuthorshipStatementContentForcedTip: The settings of this school dictate that the school-wide Statement of Authorship for exam-unrelated sheets must be used. Custom statements are prohibited.
SheetAuthorshipStatementContentOverridesExamTip: If this exercise sheet is related to an exam with an exam-wide Statement of Authorship set, a sheet-specific adaptation can be given here.

View File

@ -66,7 +66,7 @@ makeSheetForm cId msId template = identifyForm FIDsheet . validateForm validateS
(Just sId) -> liftHandler $ runDB $ getFtIdMap sId
MsgRenderer mr <- getMsgRenderer
ctime <- ceilingQuarterHour <$> liftIO getCurrentTime
((_school, _mSchoolAuthorshipStatement), _course) <- liftHandler . runDB $ do
((School{..}, mSchoolAuthorshipStatement), _course) <- liftHandler . runDB $ do
course@Course{courseSchool} <- get404 cId
school@School{..} <- get404 courseSchool
mSchoolAuthorshipStatement <- runMaybeT $ do
@ -105,31 +105,28 @@ makeSheetForm cId msId template = identifyForm FIDsheet . validateForm validateS
<*> aopt htmlField (fslI MsgSheetMarking) (sfMarkingText <$> template)
<*> apopt checkBoxField (fslI MsgSheetAnonymousCorrection & setTooltip MsgSheetAnonymousCorrectionTip) (sfAnonymousCorrection <$> template)
<*> correctorForm (maybe mempty sfCorrectors template)
<* aformSection MsgSheetAuthorshipStatementSection
-- TODO: add info: applies to exam-unrelated sheets and overrides exam definition if sheet is related to an exam and this exam has an authorship statement
-- TODO: compare versions: school > msId if school statement is newer than msId statement, msId > school otherwise (TODO: add lastEdited to model)
<*> pure Nothing -- TODO
-- <*> optionalActionA
-- ( areq htmlField
-- (fslI MsgSheetAuthorshipStatementContent)
-- (
-- -- TODO: select correct school settings wrt. exam-related/exam-unrelated
-- -- TODO: if school enforces school-wide statement, take school-wide statement
-- -- TODO: otherwise, take value from template, or take exam-wide statement if there is any, or take the school default if there is any
-- (fromMaybe mempty $ sfAuthorshipStatement <$> template <|> (Just . authorshipStatementDefinitionContent . entityVal) <$> mSchoolAuthorshipStatement)
-- )
-- )
-- ( fslI MsgSheetAuthorshipStatementRequired
-- & setTooltip MsgSheetAuthorshipStatementRequiredTip
-- -- TODO: set disabled attr if school mode disables or enforces statements
-- -- TODO: select school mode wrt. exam-related/exam-unrelated: Is this sheet related to an exam? If yes, take school exam sheet mode, otherwise take school sheet mode
-- )
-- (
-- -- TODO: if school disables/enforces statements for this sheet (exam-related/exam-unrelated?), set value accordingly
-- -- TODO: if this sheet is related to an exam and this exam enforces statements, set value accordingly
-- -- TODO: otherwise, take value from template, or `Just True` if the school has a non-empty school-wide default
-- (is _Just . sfAuthorshipStatement <$> template)
-- )
-- TODO: add info: define exam-unrelated/related, if exam-unrelated: applies to sheet, if exam-related: overrides exam-wide authship statement settings
-- TODO: compare versions of current school statement and template statement: school > template if school statement is newer than template statement, template > school otherwise (TODO: add lastEdited to models?)
<*> let
reqContentField :: (FieldSettings UniWorX -> FieldSettings UniWorX) -> AForm Handler StoredMarkup
reqContentField ttip = areq htmlField
(fslI MsgSheetAuthorshipStatementContent & ttip)
( (join $ sfAuthorshipStatement <$> template)
<|> (authorshipStatementDefinitionContent . entityVal <$> mSchoolAuthorshipStatement)
)
forcedContentField = aforced htmlField
(fslI MsgSheetAuthorshipStatementContent & setTooltip MsgSheetAuthorshipStatementContentForcedTip)
(maybe mempty (authorshipStatementDefinitionContent . entityVal) mSchoolAuthorshipStatement)
contentField ttipReq = bool forcedContentField (reqContentField ttipReq) schoolSheetAuthorshipStatementAllowOther
in case schoolSheetAuthorshipStatementMode of
SchoolAuthorshipStatementModeNone -> pure Nothing -- suppress display of whole section incl. header
otherMode -> aformSection MsgSheetAuthorshipStatementSection
*> case otherMode of
SchoolAuthorshipStatementModeOptional -> optionalActionA (contentField id)
(fslI MsgSheetAuthorshipStatementRequired & setTooltip MsgSheetAuthorshipStatementRequiredTip)
(is _Just . sfAuthorshipStatement <$> template)
SchoolAuthorshipStatementModeRequired -> fmap Just . contentField $ setTooltip MsgSheetAuthorshipStatementRequiredForcedTip
_none -> pure Nothing
where
makeSheetPersonalisedFilesForm :: Maybe SheetPersonalisedFilesForm -> MForm Handler (AForm Handler SheetPersonalisedFilesForm)
makeSheetPersonalisedFilesForm template' = do