Unify sheet type with grading schema

This commit is contained in:
Gregor Kleen 2017-10-09 19:46:45 +02:00
parent 3cebf133bf
commit 59f4c0c74a
3 changed files with 18 additions and 8 deletions

8
models
View File

@ -52,9 +52,7 @@ CourseParticipant
Sheet
courseId CourseId
name Text
sheetType SheetType
maxPoints Double Maybe
requiredPoints Double Maybe
sheetType SheetType
markingText Text Maybe
activeFrom UTCTime
activeTo UTCTime
@ -73,11 +71,11 @@ File
title FilePath
content ByteString Maybe -- Nothing iff this is a directory
modified UTCTime
deriving Show Eq Ord
deriving Show Eq
Submission
sheetId SheetId
ratingBy UserId Maybe
ratingPoints Double Maybe
ratingPoints Points Maybe
ratingComment Text Maybe
rated UTCTime Maybe
created UTCTime

View File

@ -10,3 +10,5 @@ import Settings.StaticFiles as Import
import Yesod.Auth as Import
import Yesod.Core.Types as Import (loggerSet)
import Yesod.Default.Config2 as Import
import Data.Fixed as Import

View File

@ -8,6 +8,8 @@ module Model.Types where
import ClassyPrelude
import Data.Fixed
import Common
import Database.Persist.TH
@ -26,14 +28,22 @@ import qualified Data.CaseInsensitive as CI
import Yesod.Core.Dispatch (PathPiece(..))
import Data.Aeson (FromJSON(..), ToJSON(..), withText, Value(..))
import Data.Aeson.TH (deriveJSON, defaultOptions)
import GHC.Generics (Generic)
import Data.Typeable (Typeable)
data SheetType = Regular | Bonus | Extra
deriving (Show, Read, Eq, Ord, Enum, Bounded)
derivePersistField "SheetType"
type Points = Centi
data SheetType
= Bonus { maxPoints :: Points }
| Normal { maxPoints :: Points }
| Pass { maxPoints, passingPoints :: Points }
| NotGraded
deriving (Show, Read, Eq)
deriveJSON defaultOptions ''SheetType
derivePersistFieldJSON "SheetType"
data ExamStatus = Attended | NoShow | Voided
deriving (Show, Read, Eq, Ord, Enum, Bounded)