Skip to content

Commit 910cef8

Browse files
committed
fix deletion of submissions on user merge with foreign keys
closes #CNVS-30065 Change-Id: Ie72f207ea7bbe6f84d190a2ded4b3548c00ff0e7 Reviewed-on: https://gerrit.instructure.com/82845 Tested-by: Jenkins Reviewed-by: Jeremy Stanley <jeremy@instructure.com> Product-Review: James Williams <jamesw@instructure.com> QA-Review: James Williams <jamesw@instructure.com>
1 parent 31e90c0 commit 910cef8

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/user_merge.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ def into(target_user)
132132
# a) delete empty submissions where there is a non-empty submission in the from user
133133
# b) don't delete otherwise
134134
subscope = scope.having_submission.select(unique_id)
135-
already_scope.where(unique_id => subscope).without_submission.delete_all
135+
scope_to_delete = already_scope.where(unique_id => subscope).without_submission
136+
ModeratedGrading::ProvisionalGrade.where(:submission_id => scope_to_delete).delete_all
137+
SubmissionComment.where(:submission_id => scope_to_delete).delete_all
138+
scope_to_delete.delete_all
136139
end
137140
# for the from user
138141
# a) we ignore the empty submissions in our update unless the target user has no submission

0 commit comments

Comments
 (0)