fix(course-deregister): only delete relevant users exam results
This commit is contained in:
parent
6ff46b7eb7
commit
39978574fe
@ -224,6 +224,7 @@ postCRegisterR tid ssh csh = do
|
||||
examRegistrations <- E.select . E.from $ \(examRegistration `E.InnerJoin` exam) -> do
|
||||
E.on $ examRegistration E.^. ExamRegistrationExam E.==. exam E.^. ExamId
|
||||
E.where_ $ exam E.^. ExamCourse E.==. E.val cid
|
||||
E.&&. examRegistration E.^. ExamRegistrationUser E.==. E.val uid
|
||||
return examRegistration
|
||||
forM_ examRegistrations $ \(Entity erId ExamRegistration{..}) -> do
|
||||
delete erId
|
||||
@ -232,6 +233,7 @@ postCRegisterR tid ssh csh = do
|
||||
examResults <- E.select . E.from $ \(examResult `E.InnerJoin` exam) -> do
|
||||
E.on $ examResult E.^. ExamResultExam E.==. exam E.^. ExamId
|
||||
E.where_ $ exam E.^. ExamCourse E.==. E.val cid
|
||||
E.&&. examResult E.^. ExamResultUser E.==. E.val uid
|
||||
return examResult
|
||||
forM_ examResults $ \(Entity erId ExamResult{..}) -> do
|
||||
delete erId
|
||||
|
||||
Loading…
Reference in New Issue
Block a user