Sheet edit times und fillDB angepasst

This commit is contained in:
SJost 2018-03-22 19:49:33 +01:00
parent 9f96e6dd35
commit 6fe311ee78
3 changed files with 6 additions and 14 deletions

View File

@ -98,8 +98,9 @@ main = db $ do
void . insert $ DegreeCourse ifiBsc ffp
void . insert $ DegreeCourse ifiMsc ffp
void . insert $ Lecturer gkleen ffp
void . insert $ Corrector gkleen ffp (ByProportion 1)
void . insert $ Sheet ffp "Blatt 1" Nothing NotGraded Nothing now now Nothing Nothing now now gkleen gkleen
insert_ $ Corrector gkleen ffp (ByProportion 1)
sheetkey <- insert $ Sheet ffp "Blatt 1" Nothing NotGraded NoGroups Nothing Nothing now now Nothing Nothing
insert_ $ SheetEdit gkleen sheetkey now
-- EIP
eip <- insert Course
{ courseName = "Einführung in die Programmierung"

6
models
View File

@ -103,14 +103,10 @@ Sheet
activeTo UTCTime
hintFrom UTCTime Maybe
solutionFrom UTCTime Maybe
created UTCTime -- delete
changed UTCTime -- delete
createdBy UserId -- delete
changedBy UserId -- delete
CourseSheet courseId name
SheetEdit
sheet SheetId
user UserId
sheet SheetId
time UTCTime
SheetFile
sheetId SheetId

View File

@ -278,8 +278,6 @@ getSheetEditR tid csh shn = do
}
let action newSheet = do
replaceRes <- myReplaceUnique sid $ newSheet
{ sheetCreated = sheetCreated
, sheetCreatedBy = sheetChangedBy }
case replaceRes of
Nothing -> return $ Just sid
(Just _err) -> return $ Nothing -- More specific error message for edit old sheet could go here
@ -297,8 +295,8 @@ handleSheetEdit tid csh template dbAction = do
case res of
(FormSuccess SheetForm{..}) -> do
saveOkay <- runDB $ do
cid <- getKeyBy404 $ CourseTermShort tid csh
actTime <- liftIO getCurrentTime
cid <- getKeyBy404 $ CourseTermShort tid csh
let newSheet = Sheet
{ sheetCourseId = cid
, sheetName = sfName
@ -311,10 +309,6 @@ handleSheetEdit tid csh template dbAction = do
, sheetActiveTo = sfActiveTo
, sheetHintFrom = sfHintFrom
, sheetSolutionFrom = sfSolutionFrom
, sheetCreated = actTime -- dbAction adjusts this for replacement, TODO: eigene Tabelle für changedBy
, sheetChanged = actTime
, sheetCreatedBy = aid -- dbAction adjusts this for replacement
, sheetChangedBy = aid
}
mbsid <- dbAction newSheet
case mbsid of
@ -323,6 +317,7 @@ handleSheetEdit tid csh template dbAction = do
whenIsJust sfSheetF $ insertSheetFile sid SheetExercise
whenIsJust sfHintF $ insertSheetFile sid SheetHint
whenIsJust sfSolutionF $ insertSheetFile sid SheetSolution
insert_ $ SheetEdit aid sid actTime
addMessageI "info" $ MsgSheetEditOk tident csh sfName
return True
when saveOkay $ redirect $ CSheetR tid csh $ SheetShowR sfName -- redirect must happen outside of runDB