chore(add-users): audit tutorial participant edit
This commit is contained in:
parent
b1161f27d0
commit
a4fc235ed4
@ -112,6 +112,17 @@ data Transaction
|
|||||||
{ transactionTutorial :: TutorialId
|
{ transactionTutorial :: TutorialId
|
||||||
}
|
}
|
||||||
|
|
||||||
|
| TransactionTutorialParticipantEdit
|
||||||
|
{ transactionTutorial :: TutorialId
|
||||||
|
, transactionTutorialParticipant :: TutorialParticipantId
|
||||||
|
, transactionUser :: UserId
|
||||||
|
}
|
||||||
|
| TransactionTutorialParticipantDelete
|
||||||
|
{ transactionTutorial :: TutorialId
|
||||||
|
, transactionTutorialParticipant :: TutorialParticipantId
|
||||||
|
, transactionUser :: UserId
|
||||||
|
}
|
||||||
|
|
||||||
| TransactionExternalExamEdit
|
| TransactionExternalExamEdit
|
||||||
{ transactionExternalExam :: ExternalExamId
|
{ transactionExternalExam :: ExternalExamId
|
||||||
}
|
}
|
||||||
|
|||||||
@ -287,10 +287,9 @@ upsertNewTutorial cid tutorialName = do
|
|||||||
registerTutorialMembers :: TutorialId -> Set UserId -> Handler ()
|
registerTutorialMembers :: TutorialId -> Set UserId -> Handler ()
|
||||||
registerTutorialMembers tutId (Set.toList -> users) = runDB $ do
|
registerTutorialMembers tutId (Set.toList -> users) = runDB $ do
|
||||||
prevParticipants <- fmap Set.fromList $ selectList [TutorialParticipantUser <-. users, TutorialParticipantTutorial ==. tutId] []
|
prevParticipants <- fmap Set.fromList $ selectList [TutorialParticipantUser <-. users, TutorialParticipantTutorial ==. tutId] []
|
||||||
participants <- fmap Set.fromList . for users $ \tutorialParticipantUser -> upsert
|
participants <- fmap Set.fromList . for users $ \tutorialParticipantUser -> do
|
||||||
TutorialParticipant { tutorialParticipantTutorial = tutId, .. }
|
tutPartId <- upsert TutorialParticipant { tutorialParticipantTutorial = tutId, .. } []
|
||||||
[]
|
audit $ TransactionTutorialParticipantEdit tutId tutPartId tutorialParticipantUser
|
||||||
-- TODO: audit
|
|
||||||
let newParticipants = participants Set.\\ prevParticipants
|
let newParticipants = participants Set.\\ prevParticipants
|
||||||
unless (Set.null newParticipants) $
|
unless (Set.null newParticipants) $
|
||||||
addMessageI Success . MsgCourseParticipantsRegisteredTutorial $ Set.size newParticipants
|
addMessageI Success . MsgCourseParticipantsRegisteredTutorial $ Set.size newParticipants
|
||||||
|
|||||||
Reference in New Issue
Block a user