Keep autoDistribute through sheet edits

Fixes #259
This commit is contained in:
Gregor Kleen 2018-12-21 21:19:34 +01:00
parent 8dd56dcb3e
commit 74e87c6d54

View File

@ -484,21 +484,22 @@ handleSheetEdit tid ssh csh msId template dbAction = do
saveOkay <- runDB $ do saveOkay <- runDB $ do
actTime <- liftIO getCurrentTime actTime <- liftIO getCurrentTime
cid <- getKeyBy404 $ TermSchoolCourseShort tid ssh csh cid <- getKeyBy404 $ TermSchoolCourseShort tid ssh csh
oldAutoDistribute <- fmap sheetAutoDistribute . join <$> traverse get msId
let newSheet = Sheet let newSheet = Sheet
{ sheetCourse = cid { sheetCourse = cid
, sheetName = sfName , sheetName = sfName
, sheetDescription = sfDescription , sheetDescription = sfDescription
, sheetType = sfType , sheetType = sfType
, sheetGrouping = sfGrouping , sheetGrouping = sfGrouping
, sheetMarkingText = sfMarkingText , sheetMarkingText = sfMarkingText
, sheetVisibleFrom = sfVisibleFrom , sheetVisibleFrom = sfVisibleFrom
, sheetActiveFrom = sfActiveFrom , sheetActiveFrom = sfActiveFrom
, sheetActiveTo = sfActiveTo , sheetActiveTo = sfActiveTo
, sheetHintFrom = sfHintFrom , sheetHintFrom = sfHintFrom
, sheetSolutionFrom = sfSolutionFrom , sheetSolutionFrom = sfSolutionFrom
, sheetUploadMode = sfUploadMode , sheetUploadMode = sfUploadMode
, sheetSubmissionMode = sfSubmissionMode , sheetSubmissionMode = sfSubmissionMode
, sheetAutoDistribute = False , sheetAutoDistribute = fromMaybe False oldAutoDistribute
} }
mbsid <- dbAction newSheet mbsid <- dbAction newSheet
case mbsid of case mbsid of