feat(schools): more school-wide configuration authorship statements

This commit is contained in:
Sarah Vaupel 2021-06-01 22:53:46 +02:00 committed by Gregor Kleen
parent 67c30165ae
commit 960bd76aca
8 changed files with 79 additions and 25 deletions

View File

@ -20,11 +20,13 @@ SchoolAuthorshipStatementModeNone: Keine Eigenständigkeitserklärung erlauben
SchoolAuthorshipStatementModeOptional: Eigenständigkeitserklärung optional einforderbar
SchoolAuthorshipStatementModeRequired: Eigenständigkeitserklärung immer erforderlich
SchoolSheetAuthorshipStatementMode: Modus für nicht-prüfungsrelevante Übungsblattabgaben
SchoolSheetAuthorshipStatementExamMode: Modus für prüfungsrelevante Übungsblattabgaben
SchoolSheetAuthorshipStatementText: Eigenständigkeitserklärung
SchoolSheetAuthorshipStatementTextTip: Dieser Text dient als Standard-Eigenständigkeitserklärung beim Anlegen eines neuen Übungsblattes innerhalb eines Kurses dieses Instituts. Wenn Anpassungen erlaubt sind, kann diese Erklärung pro Übungsblatt durch einen Dozierenden überschrieben werden.
SchoolSheetAuthorshipStatementAllowOther: Anpassungen erlauben?
SchoolSheetAuthorshipStatementAllowOtherTip: Soll es Dozierenden erlaubt sein, pro Übungsblatt eine abweichende Eigenständigkeitserklärung anzugeben?
SchoolSheetAuthorshipStatementDefinition: Eigenständigkeitserklärung für nicht-prüfungsrelevante Übungsblattabgaben
SchoolSheetAuthorshipStatementDefinitionTip: Deutsch und Englisch
SchoolSheetAuthorshipStatementAllowOther: Abweichende Erklärungen für nicht-prüfungsrelevante Übungsblätter erlauben?
SchoolSheetExamAuthorshipStatementMode: Modus für prüfungsrelevante Übungsblattabgaben
SchoolSheetExamAuthorshipStatementDefinition: Eigenständigkeitserklärung für prüfungsrelevante Übungsblattabgaben
SchoolSheetExamAuthorshipStatementDefinitionTip: Deutsch und Englisch
SchoolSheetExamAuthorshipStatementAllowOther: Abweichende Erklärungen für prüfungsrelevante Übungsblätter erlauben?
SchoolUpdated ssh@SchoolId: #{ssh} erfolgreich angepasst
SchoolTitle ssh@SchoolId: Institut „#{ssh}“

View File

@ -20,11 +20,13 @@ SchoolAuthorshipStatementModeNone: No Statement of Authorship allowed
SchoolAuthorshipStatementModeOptional: Statement of Authorship optionally activatable
SchoolAuthorshipStatementModeRequired: Statement of Authorship always required
SchoolSheetAuthorshipStatementMode: Mode for exam-unrelated exercise sheets
SchoolSheetAuthorshipStatementExamMode: Mode for exam-related sheets
SchoolSheetAuthorshipStatementText: Statement of Authorship
SchoolSheetAuthorshipStatementTextTip: This text serves as default Statement of Authorship upon creating a new exercise sheet in a course of this school. This statement may be overriden by a course administrator per exercise sheet if adaptations are allowed.
SchoolSheetAuthorshipStatementAllowOther: Allow adaptations?
SchoolSheetAuthorshipStatementAllowOtherTip: Should course administrators be allowed to specify an alternative Statement of Authorship?
SchoolSheetAuthorshipStatementDefinition: Statement of Authorship for exam-unrelated exercise sheets
SchoolSheetAuthorshipStatementDefinitionTip: German and English
SchoolSheetAuthorshipStatementAllowOther: Allow adaptations for exam-unrelated exercise sheets?
SchoolSheetExamAuthorshipStatementMode: Mode for exam-related exercise sheets
SchoolSheetExamAuthorshipStatementDefinition: Statement of Authorship for exam-related exercise sheets
SchoolSheetExamAuthorshipStatementDefinitionTip: German and English
SchoolSheetExamAuthorshipStatementAllowOther: Allow adaptations for exam-related exercise sheets?
SchoolUpdated ssh: Successfully edited #{ssh}
SchoolTitle ssh: Department „#{ssh}“

View File

@ -0,0 +1,17 @@
AuthorshipStatementDefinition
content StoredMarkup -- must contain statements in all relevant languages for now, TODO: refactor (use translations as below)
deriving Generic
-- AuthorshipStatementDefinitionTranslation
-- definition AuthorshipStatementDefinitionId
-- language Lang
-- content StoredMarkup
-- UniqueAuthorshipStatementDefinitionTranslation definition language
-- deriving Generic
-- Statement of Authorship to be issued upon submitting a solution for an exercise sheet
-- TODO: maybe move to SubmissionUser? (With statementSigned :: Bool, statement :: Maybe StoredMarkup)
AuthorshipStatementSubmission
submissionUser SubmissionUserId
statement StoredMarkup -- stored as plain StoredMarkup as the "signed" statement needs to be persisted
UniqueAuthorshipStatementSubmission submissionUser
deriving Generic

View File

@ -9,9 +9,11 @@ School json
examDiscouragedModes ExamModeDNF
examCloseMode ExamCloseMode default='separate'
sheetAuthorshipStatementMode SchoolAuthorshipStatementMode default='optional'
sheetAuthorshipStatementExamMode SchoolAuthorshipStatementMode default='optional'
sheetAuthorshipStatementText StoredMarkup Maybe
sheetAuthorshipStatementDefinition AuthorshipStatementDefinitionId Maybe
sheetAuthorshipStatementAllowOther Bool default=true
sheetExamAuthorshipStatementMode SchoolAuthorshipStatementMode default='optional'
sheetExamAuthorshipStatementDefinition AuthorshipStatementDefinitionId Maybe
sheetExamAuthorshipStatementAllowOther Bool default=true
UniqueSchool name
UniqueSchoolShorthand shorthand -- required for Normalisation of CI Text
Primary shorthand -- newtype Key School = SchoolKey { unSchoolKey :: SchoolShorthand }

View File

@ -15,6 +15,8 @@ Sheet -- exercise sheet for a given course
anonymousCorrection Bool default=true
requireExamRegistration ExamId Maybe -- Students may only submit if they are registered for the given exam
allowNonPersonalisedSubmission Bool default=true
-- authorshipStatementRequired Bool default=false
-- authorshipStatementDefinition AuthorshipStatementDefinitionId Maybe
CourseSheet course name
deriving Generic
SheetEdit -- who edited when a row in table "Course", kept indefinitely

View File

@ -69,9 +69,11 @@ data SchoolForm = SchoolForm
, sfExamDiscouragedModes :: ExamModeDNF
, sfExamCloseMode :: ExamCloseMode
, sfSheetAuthorshipStatementMode :: SchoolAuthorshipStatementMode
, sfSheetAuthorshipStatementExamMode :: SchoolAuthorshipStatementMode
, sfSheetAuthorshipStatementText :: Maybe StoredMarkup
, sfSheetAuthorshipStatementDefinition :: Maybe StoredMarkup -- TODO: Must contain statements in all relevant languages for now; later use `Maybe (Map Lang StoredMarkup)` instead
, sfSheetAuthorshipStatementAllowOther :: Bool
, sfSheetExamAuthorshipStatementMode :: SchoolAuthorshipStatementMode
, sfSheetExamAuthorshipStatementDefinition :: Maybe StoredMarkup -- TODO: Must contain statements in all relevant languages for now; later use `Maybe (Map Lang StoredMarkup)` instead
, sfSheetExamAuthorshipStatementAllowOther :: Bool
}
mkSchoolForm :: Maybe SchoolId -> Maybe SchoolForm -> Form SchoolForm
@ -87,9 +89,11 @@ mkSchoolForm mSsh template = renderAForm FormStandard $ SchoolForm
<*> apopt (selectField optionsFinite) (fslI MsgExamCloseMode) (sfExamCloseMode <$> template <|> pure ExamCloseSeparate)
<* aformSection MsgSchoolAuthorshipStatementSection
<*> apopt (selectField optionsFinite) (fslI MsgSchoolSheetAuthorshipStatementMode) (sfSheetAuthorshipStatementMode <$> template <|> pure SchoolAuthorshipStatementModeOptional)
<*> apopt (selectField optionsFinite) (fslI MsgSchoolSheetAuthorshipStatementExamMode) (sfSheetAuthorshipStatementExamMode <$> template <|> pure SchoolAuthorshipStatementModeOptional)
<*> aopt htmlField (fslI MsgSchoolSheetAuthorshipStatementText & setTooltip MsgSchoolSheetAuthorshipStatementTextTip) (sfSheetAuthorshipStatementText <$> template)
<*> apopt checkBoxField (fslI MsgSchoolSheetAuthorshipStatementAllowOther & setTooltip MsgSchoolSheetAuthorshipStatementAllowOtherTip) (sfSheetAuthorshipStatementAllowOther <$> template <|> pure True)
<*> aopt htmlField (fslI MsgSchoolSheetAuthorshipStatementDefinition & setTooltip MsgSchoolSheetAuthorshipStatementDefinitionTip) (sfSheetAuthorshipStatementDefinition <$> template)
<*> apopt checkBoxField (fslI MsgSchoolSheetAuthorshipStatementAllowOther) (sfSheetAuthorshipStatementAllowOther <$> template <|> pure True)
<*> apopt (selectField optionsFinite) (fslI MsgSchoolSheetExamAuthorshipStatementMode) (sfSheetExamAuthorshipStatementMode <$> template <|> pure SchoolAuthorshipStatementModeOptional)
<*> aopt htmlField (fslI MsgSchoolSheetExamAuthorshipStatementDefinition & setTooltip MsgSchoolSheetExamAuthorshipStatementDefinitionTip) (sfSheetExamAuthorshipStatementDefinition <$> template)
<*> apopt checkBoxField (fslI MsgSchoolSheetExamAuthorshipStatementAllowOther) (sfSheetExamAuthorshipStatementAllowOther <$> template <|> pure True)
where
ldapOrgs :: HandlerFor UniWorX (OptionList (CI Text))
ldapOrgs = fmap (mkOptionList . map (\t -> Option (CI.original t) t (CI.original t)) . Set.toAscList) . runDB $
@ -99,6 +103,15 @@ schoolToForm :: SchoolId -> DB (Form SchoolForm)
schoolToForm ssh = do
School{..} <- get404 ssh
ldapFrags <- selectList [SchoolLdapSchool ==. Just ssh] []
-- TODO: allow for separate translations
-- let getAuthorshipStatementDefs = maybe (return Nothing) (\definitionId -> Just <$> selectList [ AuthorshipStatementDefinitionTranslationDefinition ==. definitionId ] [])
-- authorshipStatementDefs <- getAuthorshipStatementDefs schoolSheetAuthorshipStatementDefinition
-- examAuthorshipStatementDefs <- getAuthorshipStatementDefs schoolSheetExamAuthorshipStatementDefinition
mSheetAuthorshipStatementDefinition <- maybe (return Nothing) get schoolSheetAuthorshipStatementDefinition
mSheetExamAuthorshipStatementDefinition <- maybe (return Nothing) get schoolSheetExamAuthorshipStatementDefinition
return . mkSchoolForm (Just ssh) $ Just SchoolForm
{ sfShorthand = schoolShorthand
, sfName = schoolName
@ -109,9 +122,11 @@ schoolToForm ssh = do
, sfExamDiscouragedModes = schoolExamDiscouragedModes
, sfExamCloseMode = schoolExamCloseMode
, sfSheetAuthorshipStatementMode = schoolSheetAuthorshipStatementMode
, sfSheetAuthorshipStatementExamMode = schoolSheetAuthorshipStatementExamMode
, sfSheetAuthorshipStatementText = schoolSheetAuthorshipStatementText
, sfSheetAuthorshipStatementDefinition = authorshipStatementDefinitionContent <$> mSheetAuthorshipStatementDefinition
, sfSheetAuthorshipStatementAllowOther = schoolSheetAuthorshipStatementAllowOther
, sfSheetExamAuthorshipStatementMode = schoolSheetExamAuthorshipStatementMode
, sfSheetExamAuthorshipStatementDefinition = authorshipStatementDefinitionContent <$> mSheetExamAuthorshipStatementDefinition
, sfSheetExamAuthorshipStatementAllowOther = schoolSheetExamAuthorshipStatementAllowOther
}
@ -126,6 +141,9 @@ postSchoolEditR ssh = do
formResult sfResult $ \SchoolForm{..} -> do
runDB $ do
let
mAuthorshipStatementId = error "WIP upsert authorship statement"
mExamAuthorshipStatementId = error "WIP upsert exam authorship statement"
update ssh
[ SchoolName =. sfName
, SchoolExamMinimumRegisterBeforeStart =. sfExamMinimumRegisterBeforeStart
@ -134,9 +152,11 @@ postSchoolEditR ssh = do
, SchoolExamDiscouragedModes =. sfExamDiscouragedModes
, SchoolExamCloseMode =. sfExamCloseMode
, SchoolSheetAuthorshipStatementMode =. sfSheetAuthorshipStatementMode
, SchoolSheetAuthorshipStatementExamMode =. sfSheetAuthorshipStatementExamMode
, SchoolSheetAuthorshipStatementText =. sfSheetAuthorshipStatementText
, SchoolSheetAuthorshipStatementDefinition =. mAuthorshipStatementId
, SchoolSheetAuthorshipStatementAllowOther =. sfSheetAuthorshipStatementAllowOther
, SchoolSheetExamAuthorshipStatementMode =. sfSheetExamAuthorshipStatementMode
, SchoolSheetExamAuthorshipStatementDefinition =. mExamAuthorshipStatementId
, SchoolSheetExamAuthorshipStatementAllowOther =. sfSheetExamAuthorshipStatementAllowOther
]
forM_ sfOrgUnits $ \schoolLdapOrgUnit ->
void $ upsert SchoolLdap
@ -171,6 +191,9 @@ postSchoolNewR = do
formResult sfResult $ \SchoolForm{..} -> do
let ssh = SchoolKey sfShorthand
insertOkay <- runDB $ do
let
mAuthorshipStatementId = error "WIP insert authorship statement"
mExamAuthorshipStatementId = error "WIP insert exam authorship statement"
didInsert <- is _Just <$> insertUnique School
{ schoolShorthand = sfShorthand
, schoolName = sfName
@ -180,9 +203,11 @@ postSchoolNewR = do
, schoolExamDiscouragedModes = sfExamDiscouragedModes
, schoolExamCloseMode = sfExamCloseMode
, schoolSheetAuthorshipStatementMode = sfSheetAuthorshipStatementMode
, schoolSheetAuthorshipStatementExamMode = sfSheetAuthorshipStatementExamMode
, schoolSheetAuthorshipStatementText = sfSheetAuthorshipStatementText
, schoolSheetAuthorshipStatementDefinition = mAuthorshipStatementId
, schoolSheetAuthorshipStatementAllowOther = sfSheetAuthorshipStatementAllowOther
, schoolSheetExamAuthorshipStatementMode = sfSheetExamAuthorshipStatementMode
, schoolSheetExamAuthorshipStatementDefinition = mExamAuthorshipStatementId
, schoolSheetExamAuthorshipStatementAllowOther = sfSheetExamAuthorshipStatementAllowOther
}
when didInsert $ do
insert_ UserFunction

View File

@ -103,6 +103,9 @@ data ManualMigration
| Migration20210208StudyFeaturesRelevanceCachedUUIDs
| Migration20210318CrontabSubmissionRatedNotification
| Migration20210608SeparateTermActive
-- TODO: migration regarding authorship statements
-- - apply desired non-default modes for IfI
-- - set authorship statement texts for IfI
deriving (Eq, Ord, Read, Show, Enum, Bounded, Generic, Typeable)
deriving anyclass (Universe, Finite)

View File

@ -411,8 +411,9 @@ fillDb = do
, termLectureEnd
}
void . insert_ $ TermActive (TermKey term) (toMidnight $ addDays (-60) termStart) (Just . beforeMidnight $ addDays 60 termEnd) Nothing
ifi <- insert' $ School "Institut für Informatik" "IfI" (Just $ 14 * nominalDay) (Just $ 10 * nominalDay) True (ExamModeDNF predDNFFalse) (ExamCloseOnFinished True) SchoolAuthorshipStatementModeOptional SchoolAuthorshipStatementModeRequired (Just "<strong>Erklärung über die eigenständige Bearbeitung</strong><br><br>Hiermit erkläre ich, dass ich die vorliegende Abgabe vollständig selbstständig angefertigt habe, bzw. dass bei einer Gruppen-Abgabe nur die bei der Abgabe benannten Personen mitgewirkt haben.<br><br>Quellen und Hilfsmittel über den Rahmen der Lehrveranstaltung hinaus sind als solche markiert und angegeben. Direkte Zitate sind als solche kenntlich gemacht.<br><br>Ich bin mir darüber im Klaren, dass Verstöße durch Plagiate oder Zusammenarbeit mit Dritten zum Ausschluss von der Veranstaltung führen.") False
mi <- insert' $ School "Institut für Mathematik" "MI" Nothing Nothing False (ExamModeDNF predDNFFalse) (ExamCloseOnFinished False) SchoolAuthorshipStatementModeNone SchoolAuthorshipStatementModeOptional Nothing True
ifiAuthorshipStatement <- insert $ AuthorshipStatementDefinition "<strong>Erklärung über die eigenständige Bearbeitung</strong><p>Hiermit erkläre ich, dass ich die vorliegende Abgabe vollständig selbstständig angefertigt habe, bzw. dass bei einer Gruppen-Abgabe nur die bei der Abgabe benannten Personen mitgewirkt haben. Quellen und Hilfsmittel über den Rahmen der Lehrveranstaltung hinaus sind als solche markiert und angegeben. Direkte Zitate sind als solche kenntlich gemacht. Ich bin mir darüber im Klaren, dass Verstöße durch Plagiate oder Zusammenarbeit mit Dritten zum Ausschluss von der Veranstaltung führen.</p><strong>Statement of Authorship</strong><p>TODO English version</p>"
ifi <- insert' $ School "Institut für Informatik" "IfI" (Just $ 14 * nominalDay) (Just $ 10 * nominalDay) True (ExamModeDNF predDNFFalse) (ExamCloseOnFinished True) SchoolAuthorshipStatementModeOptional (Just ifiAuthorshipStatement) True SchoolAuthorshipStatementModeRequired (Just ifiAuthorshipStatement) False
mi <- insert' $ School "Institut für Mathematik" "MI" Nothing Nothing False (ExamModeDNF predDNFFalse) (ExamCloseOnFinished False) SchoolAuthorshipStatementModeNone Nothing True SchoolAuthorshipStatementModeOptional Nothing True
void . insert' $ UserFunction gkleen ifi SchoolAdmin
void . insert' $ UserFunction gkleen mi SchoolAdmin
void . insert' $ UserFunction fhamann ifi SchoolAdmin