fix(course-users): insertUnique and only count and audit true inserts
This commit is contained in:
parent
b8acc9b5da
commit
1325ff2a95
@ -532,14 +532,17 @@ postCUsersR tid ssh csh = do
|
||||
Sum nrReg <- fmap mconcat . runDB . forM (Set.toList selectedUsers) $ \uid -> do
|
||||
now <- liftIO getCurrentTime
|
||||
-- TODO allow occurence
|
||||
insert_ ExamRegistration
|
||||
mExamReg <- insertUnique ExamRegistration
|
||||
{ examRegistrationExam = registerExam
|
||||
, examRegistrationUser = uid
|
||||
, examRegistrationOccurrence = Nothing
|
||||
, examRegistrationTime = now
|
||||
}
|
||||
audit $ TransactionExamRegister registerExam uid
|
||||
return 1
|
||||
if isJust mExamReg
|
||||
then do
|
||||
audit $ TransactionExamRegister registerExam uid
|
||||
return 1
|
||||
else return 0
|
||||
addMessageI Success $ MsgCourseUsersExamRegistered nrReg
|
||||
redirect $ CourseR tid ssh csh CUsersR
|
||||
let headingLong = [whamlet|_{MsgMenuCourseMembers} #{courseName course} #{tid}|]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user