feat(sheets): eliminate authship statement required Bool

This commit is contained in:
Sarah Vaupel 2021-06-03 14:52:34 +02:00 committed by Gregor Kleen
parent 996262c327
commit 0735c05a74
7 changed files with 17 additions and 32 deletions

View File

@ -154,6 +154,4 @@ SheetGradingPassAlways: Automatisch bestanden, sobald korrigiert
SheetAuthorshipStatement: Eigenständigkeitserklärung
SheetAuthorshipStatementRequired: Eigenständigkeitserklärung einfordern?
SheetAuthorshipStatementRequiredTip: Soll jeder Abgebender (bei Gruppenabgaben jedes Gruppenmitglied der Abgabegruppe) vor dem Anlegen einer Abgabe dazu aufgefordert werden, eine Eigenständigkeitserklärung zu akzeptieren?
SheetAuthorshipStatementDefinition: Eigenständigkeitserklärung
SheetAuthorshipStatementDefinitionTip: Wird eine Eigenständigkeitserklärung eingefordert, so müssen Abgebende diesen Text akzeptieren (durch Setzen eines Hakens).
SheetAuthorshipStatementRequiredTip: Soll jeder Abgebende (bei Abgabegruppen jedes Mitglied der Abgabegruppe) aufgefordert werden, eine Eigenständigkeitserklärung zu akzeptieren?

View File

@ -153,6 +153,4 @@ SheetGradingPassAlways: Automatically passed when corrected
SheetAuthorshipStatement: Statement of Authorship
SheetAuthorshipStatementRequired: Require Statement of Authorship for submissions?
SheetAuthorshipStatementRequiredTip: Should submittors (in case of group submissions every submission group member) be required to accept a Statement of Authorship upon creating a submission?
SheetAuthorshipStatementDefinition: Statement of Authorship
SheetAuthorshipStatementDefinitionTip: If a Statement of Authorship is required, submittors are required to accept this statement (by ticking a checkbox).
SheetAuthorshipStatementRequiredTip: Should each submittor (in case of submission groups each group member) be required to accept a Statement of Authorship?

View File

@ -15,8 +15,7 @@ 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
authorshipStatement AuthorshipStatementDefinitionId Maybe
CourseSheet course name
deriving Generic
SheetEdit -- who edited when a row in table "Course", kept indefinitely

View File

@ -29,7 +29,7 @@ postSEditR tid ssh csh shn = do
<$> fmap (foldMap $ \(Entity _ SheetCorrector{..}) -> Map.singleton (Right sheetCorrectorUser) (InvDBDataSheetCorrector sheetCorrectorLoad sheetCorrectorState, InvTokenDataSheetCorrector)) (selectList [ SheetCorrectorSheet ==. sid ] [])
<*> fmap (fmap (, InvTokenDataSheetCorrector) . Map.mapKeysMonotonic Left) (sourceInvitationsF sid)
hasPersonalisedFiles <- exists [ PersonalisedSheetFileSheet ==. sid ]
mAuthorshipStatement <- maybe (pure Nothing) get sheetAuthorshipStatementDefinition
mAuthorshipStatement <- maybe (pure Nothing) get sheetAuthorshipStatement
return (ent, fti, cLoads, hasPersonalisedFiles, mAuthorshipStatement)
let template = Just $ SheetForm
{ sfName = sheetName
@ -56,8 +56,7 @@ postSEditR tid ssh csh shn = do
, spffAllowNonPersonalisedSubmission = sheetAllowNonPersonalisedSubmission
, spffFiles = Nothing
}
, sfAuthorshipStatementRequired = sheetAuthorshipStatementRequired
, sfAuthorshipStatementDefinition = authorshipStatementDefinitionContent <$> mAuthorshipStatement
, sfAuthorshipStatement = authorshipStatementDefinitionContent <$> mAuthorshipStatement
}
let action = uniqueReplace sid -- More specific error message for edit old sheet could go here by using myReplaceUnique instead
@ -78,14 +77,14 @@ handleSheetEdit tid ssh csh msId template dbAction = do
mOldAuthorshipStatement <- runMaybeT $ do
sId <- MaybeT . return $ msId
Entity _ Sheet{..} <- MaybeT $ getEntity sId
statementId <- MaybeT . return $ sheetAuthorshipStatementDefinition
statementId <- MaybeT . return $ sheetAuthorshipStatement
MaybeT $ getEntity statementId
if
| Just newDef@(AuthorshipStatementDefinition newContent) <- mNewStatement
, maybe True ((/=) newContent . authorshipStatementDefinitionContent . entityVal) mOldAuthorshipStatement
-> Just <$> (insert newDef)
| otherwise -> return $ entityKey <$> mOldAuthorshipStatement
mNewAuthorshipStatementId <- insertNewOrKeepStatement $ bool Nothing (AuthorshipStatementDefinition <$> sfAuthorshipStatementDefinition) sfAuthorshipStatementRequired
mNewAuthorshipStatementId <- insertNewOrKeepStatement $ AuthorshipStatementDefinition <$> sfAuthorshipStatement
let newSheet = Sheet
{ sheetCourse = cid
@ -104,8 +103,7 @@ handleSheetEdit tid ssh csh msId template dbAction = do
, sheetAnonymousCorrection = sfAnonymousCorrection
, sheetRequireExamRegistration = sfRequireExamRegistration
, sheetAllowNonPersonalisedSubmission = maybe True spffAllowNonPersonalisedSubmission sfPersonalF
, sheetAuthorshipStatementRequired = sfAuthorshipStatementRequired
, sheetAuthorshipStatementDefinition = mNewAuthorshipStatementId
, sheetAuthorshipStatement = mNewAuthorshipStatementId
}
mbsid <- dbAction newSheet
case mbsid of

View File

@ -42,8 +42,7 @@ data SheetForm = SheetForm
, sfMarkingText :: Maybe StoredMarkup
, sfAnonymousCorrection :: Bool
, sfCorrectors :: Loads
, sfAuthorshipStatementRequired :: Bool
, sfAuthorshipStatementDefinition :: Maybe StoredMarkup
, sfAuthorshipStatement :: Maybe StoredMarkup
}
data SheetPersonalisedFilesForm = SheetPersonalisedFilesForm
@ -100,8 +99,7 @@ makeSheetForm cId msId template = identifyForm FIDsheet . validateForm validateS
<*> apopt checkBoxField (fslI MsgSheetAnonymousCorrection & setTooltip MsgSheetAnonymousCorrectionTip) (sfAnonymousCorrection <$> template)
<*> correctorForm (maybe mempty sfCorrectors template)
<* aformSection MsgSheetAuthorshipStatement
<*> apopt checkBoxField (fslI MsgSheetAuthorshipStatementRequired & setTooltip MsgSheetAuthorshipStatementRequiredTip) (sfAuthorshipStatementRequired <$> template) -- TODO: this checkBoxField needs to be disabled and set accordingly if the school settings do not allow other statements
<*> aopt htmlField (fslI MsgSheetAuthorshipStatementDefinition & setTooltip MsgSheetAuthorshipStatementDefinitionTip) (sfAuthorshipStatementDefinition <$> template) -- TODO: use school definition
<*> optionalActionA (apreq htmlField (fslI MsgSheetAuthorshipStatement) (join $ sfAuthorshipStatement <$> template)) (fslI MsgSheetAuthorshipStatementRequired & setTooltip MsgSheetAuthorshipStatementRequiredTip) (is _Just . sfAuthorshipStatement <$> template) -- TODO: if template is empty, use school definition as default -- TODO: disable option and set accordingly if school mode prevents edits
where
makeSheetPersonalisedFilesForm :: Maybe SheetPersonalisedFilesForm -> MForm Handler (AForm Handler SheetPersonalisedFilesForm)
makeSheetPersonalisedFilesForm template' = do

View File

@ -39,7 +39,7 @@ postSheetNewR tid ssh csh = do
E.where_ $ sheetEdit E.^. SheetEditSheet E.==. sheet E.^. SheetId
return . E.min_ $ sheetEdit E.^. SheetEditTime
mAuthorshipStatement = E.subSelect . E.from $ \authorshipStatementDefinition -> do
E.where_ $ E.just (authorshipStatementDefinition E.^. AuthorshipStatementDefinitionId) E.==. sheet E.^. SheetAuthorshipStatementDefinition
E.where_ $ E.just (authorshipStatementDefinition E.^. AuthorshipStatementDefinitionId) E.==. sheet E.^. SheetAuthorshipStatement
return $ authorshipStatementDefinition E.^. AuthorshipStatementDefinitionContent
return (sheet, firstEdit, mAuthorshipStatement)
cid <- getKeyBy404 $ TermSchoolCourseShort tid ssh csh
@ -70,8 +70,7 @@ postSheetNewR tid ssh csh = do
, sfAnonymousCorrection = sheetAnonymousCorrection
, sfRequireExamRegistration = Nothing
, sfPersonalF = Nothing
, sfAuthorshipStatementRequired = sheetAuthorshipStatementRequired
, sfAuthorshipStatementDefinition = mAuthorshipStatement
, sfAuthorshipStatement = mAuthorshipStatement
}
_other -> Nothing
let action = -- More specific error message for new sheet could go here, if insertUnique returns Nothing

View File

@ -657,8 +657,7 @@ fillDb = do
, sheetAnonymousCorrection = True
, sheetRequireExamRegistration = Nothing
, sheetAllowNonPersonalisedSubmission = True
, sheetAuthorshipStatementRequired = False
, sheetAuthorshipStatementDefinition = Just ifiAuthorshipStatement
, sheetAuthorshipStatement = Nothing
}
insert_ $ SheetEdit gkleen now adhoc
feste <- insert Sheet
@ -678,8 +677,7 @@ fillDb = do
, sheetAnonymousCorrection = True
, sheetRequireExamRegistration = Nothing
, sheetAllowNonPersonalisedSubmission = True
, sheetAuthorshipStatementRequired = False
, sheetAuthorshipStatementDefinition = Just ifiAuthorshipStatement
, sheetAuthorshipStatement = Nothing
}
insert_ $ SheetEdit gkleen now feste
keine <- insert Sheet
@ -699,8 +697,7 @@ fillDb = do
, sheetAnonymousCorrection = True
, sheetRequireExamRegistration = Nothing
, sheetAllowNonPersonalisedSubmission = True
, sheetAuthorshipStatementRequired = False
, sheetAuthorshipStatementDefinition = Just ifiAuthorshipStatement
, sheetAuthorshipStatement = Nothing
}
insert_ $ SheetEdit gkleen now keine
void . insertMany $ map (\u -> CourseParticipant ffp u now Nothing CourseParticipantActive)
@ -945,8 +942,7 @@ fillDb = do
, sheetAnonymousCorrection = True
, sheetRequireExamRegistration = Nothing
, sheetAllowNonPersonalisedSubmission = True
, sheetAuthorshipStatementRequired = False
, sheetAuthorshipStatementDefinition = Just ifiAuthorshipStatement
, sheetAuthorshipStatement = Nothing
}
void . insert $ SheetEdit jost now shId
when (submissionModeCorrector sheetSubmissionMode) $
@ -1190,8 +1186,7 @@ fillDb = do
, sheetAnonymousCorrection = True
, sheetRequireExamRegistration = Nothing
, sheetAllowNonPersonalisedSubmission = True
, sheetAuthorshipStatementRequired = shNr == 14
, sheetAuthorshipStatementDefinition = Just ifiAuthorshipStatement
, sheetAuthorshipStatement = if shNr == 14 then Just ifiAuthorshipStatement else Nothing
}
manyUsers' <- shuffleM $ take 1024 manyUsers
groupSizes <- getRandomRs (1, 3)