Rough sketch of models/exams
This commit is contained in:
parent
db915f5736
commit
09196971f8
60
models/exams
60
models/exams
@ -1,22 +1,40 @@
|
|||||||
-- EXAMS ARE TODO; THIS IS JUST AN UNUSED STUB
|
|
||||||
Exam
|
Exam
|
||||||
course CourseId
|
course CourseId
|
||||||
name Text
|
name (CI Text)
|
||||||
description Text
|
gradingKey [Points] -- [n1,n2,n3,...] means 0 <= p < n1 -> p ~= 5, n1 <= p < n2 -> p ~ 4.7, n2 <= p < n3 -> p ~ 4.3, ...
|
||||||
begin UTCTime
|
bonusRule ExamBonusRule
|
||||||
end UTCTime
|
occuranceRule ExamOccuranceRule
|
||||||
registrationBegin UTCTime
|
registerFrom UTCTime Maybe
|
||||||
registrationEnd UTCTime
|
registerTo UTCTime Maybe
|
||||||
deregistrationEnd UTCTime
|
deregisterUntil UTCTime Maybe
|
||||||
ratingVisible Bool -- may participants see their own rating yet
|
start UTCTime
|
||||||
statisticsVisible Bool -- may participants view statistics over all participants (should not be allowed for 'small' courses)
|
end UTCTime Maybe
|
||||||
--ExamEdit
|
finished UTCTime Maybe -- Grades shown to students, `ExamCorrector`s locked out
|
||||||
-- user UserId
|
closed Bool -- Prüfungsamt hat Einsicht (notification)
|
||||||
-- time UTCTime
|
publicStatistics Bool
|
||||||
-- exam ExamId
|
description Html Maybe
|
||||||
--ExamUser
|
UniqueExam course name
|
||||||
-- user UserId
|
ExamPart
|
||||||
-- examId ExamId
|
exam ExamId
|
||||||
-- -- CONTINUE HERE: Include rating in this table or separately?
|
name (CI Text)
|
||||||
-- UniqueExamUser user examId
|
maxPoints Points Maybe
|
||||||
-- By default this file is used in Model.hs (which is imported by Foundation.hs)
|
weight Rational
|
||||||
|
UniqueExamPart exam name
|
||||||
|
ExamOccurance
|
||||||
|
exam ExamId
|
||||||
|
room Text
|
||||||
|
capacity Natural
|
||||||
|
ExamRegistration
|
||||||
|
exam ExamId
|
||||||
|
user UserId
|
||||||
|
occurance ExamOccuranceId Maybe
|
||||||
|
UniqueExamRegistration exam user
|
||||||
|
ExamResult
|
||||||
|
examPart ExamPartId
|
||||||
|
user UserId
|
||||||
|
result ExamPartResult
|
||||||
|
UniqueExamResult examPart user
|
||||||
|
ExamCorrector
|
||||||
|
examPart ExamPartId
|
||||||
|
user UserId
|
||||||
|
UniqueExamCorrector examPart user
|
||||||
@ -288,6 +288,10 @@ customMigrations = Map.fromListWith (>>)
|
|||||||
tableDropEmpty "tutorial"
|
tableDropEmpty "tutorial"
|
||||||
tableDropEmpty "tutorial_user"
|
tableDropEmpty "tutorial_user"
|
||||||
)
|
)
|
||||||
|
, ( AppliedMigrationKey [migrationVersion|12.0.0|] [version|13.0.0|]
|
||||||
|
, whenM (tableExists "exam") $ -- Exams were an unused stub before
|
||||||
|
tableDropEmpty "exam"
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -366,9 +366,42 @@ classifySubmissionMode (SubmissionMode False (Just _)) = SubmissionModeUser
|
|||||||
classifySubmissionMode (SubmissionMode True (Just _)) = SubmissionModeBoth
|
classifySubmissionMode (SubmissionMode True (Just _)) = SubmissionModeBoth
|
||||||
|
|
||||||
|
|
||||||
data ExamStatus = Attended | NoShow | Voided
|
data ExamPartResult = ExamAttended { examPartResult :: Maybe Points }
|
||||||
deriving (Show, Read, Eq, Ord, Enum, Bounded, Generic)
|
| ExamNoShow
|
||||||
derivePersistField "ExamStatus"
|
| ExamVoided
|
||||||
|
deriving (Show, Read, Eq, Ord, Generic, Typeable)
|
||||||
|
deriveJSON defaultOptions
|
||||||
|
{ constructorTagModifier = camelToPathPiece' 1
|
||||||
|
, fieldLabelModifier = camelToPathPiece' 2
|
||||||
|
, omitNothingFields = True
|
||||||
|
, sumEncoding = TaggedObject "status" "result"
|
||||||
|
} ''ExamPartResult
|
||||||
|
derivePersistFieldJSON ''ExamPartResult
|
||||||
|
|
||||||
|
data ExamBonusRule = ExamNoBonus
|
||||||
|
| ExamBonusPoints
|
||||||
|
{ bonusExchangeRate :: Rational
|
||||||
|
, bonusOnlyPassed :: Bool
|
||||||
|
}
|
||||||
|
deriving (Show, Read, Eq, Ord, Generic, Typeable)
|
||||||
|
deriveJSON defaultOptions
|
||||||
|
{ constructorTagModifier = camelToPathPiece' 1
|
||||||
|
, fieldLabelModifier = camelToPathPiece' 1
|
||||||
|
, sumEncoding = TaggedObject "rule" "settings"
|
||||||
|
} ''ExamBonusRule
|
||||||
|
derivePersistFieldJSON ''ExamBonusRule
|
||||||
|
|
||||||
|
data ExamOccuranceRule = ExamRoomManual
|
||||||
|
| ExamRoomSurname
|
||||||
|
| ExamRoomMatriculation
|
||||||
|
| ExamRoomRandom
|
||||||
|
deriving (Show, Read, Eq, Ord, Generic, Typeable)
|
||||||
|
deriveJSON defaultOptions
|
||||||
|
{ constructorTagModifier = camelToPathPiece' 2
|
||||||
|
, fieldLabelModifier = camelToPathPiece' 1
|
||||||
|
, sumEncoding = TaggedObject "rule" "settings"
|
||||||
|
} ''ExamOccuranceRule
|
||||||
|
derivePersistFieldJSON ''ExamOccuranceRule
|
||||||
|
|
||||||
-- | Specify a corrector's workload
|
-- | Specify a corrector's workload
|
||||||
data Load -- = ByTutorial { countsToLoad :: Bool } | ByProportion { load :: Rational }
|
data Load -- = ByTutorial { countsToLoad :: Bool } | ByProportion { load :: Rational }
|
||||||
|
|||||||
Reference in New Issue
Block a user