Merge branch 'master' into 'live'

Fix #235

Closes #235

See merge request !99
This commit is contained in:
Gregor Kleen 2018-11-19 14:38:38 +01:00
commit 2ec32ddce9

View File

@ -517,18 +517,19 @@ postCorrectionR tid ssh csh shn cid = do
case corrResult of case corrResult of
FormMissing -> return () FormMissing -> return ()
FormFailure errs -> mapM_ (addMessage Error . toHtml) errs FormFailure errs -> mapM_ (addMessage Error . toHtml) errs
FormSuccess (rated, ratingPoints', ratingComment') FormSuccess (rated, ratingPoints', ratingComment') -> do
| errs <- validateRating sheetType Rating'
{ ratingPoints=ratingPoints'
, ratingComment=ratingComment'
, ratingTime=Nothing
}
-> mapM_ (addMessageI Error) errs
| otherwise -> do
runDBJobs $ do
uid <- liftHandlerT requireAuthId uid <- liftHandlerT requireAuthId
now <- liftIO getCurrentTime now <- liftIO getCurrentTime
if
| errs <- validateRating sheetType Rating'
{ ratingPoints = ratingPoints'
, ratingComment = ratingComment'
, ratingTime = (now <$ guard rated)
}
, not $ null errs
-> mapM_ (addMessageI Error) errs
| otherwise -> runDBJobs $ do
update sub [ SubmissionRatingBy =. Just uid update sub [ SubmissionRatingBy =. Just uid
, SubmissionRatingTime =. (now <$ guard rated) , SubmissionRatingTime =. (now <$ guard rated)
, SubmissionRatingPoints =. ratingPoints' , SubmissionRatingPoints =. ratingPoints'