Fix team data deletion, add user assignments deletion for PET

This commit is contained in:
Oleksii Kriuchykhin 2023-01-16 15:08:50 +01:00
parent 8dca8e858f
commit 2d8392f6c0

View file

@ -48,6 +48,7 @@ class UserDataDeletion
my_module.protocols.each do |protocol| my_module.protocols.each do |protocol|
destroy_protocol(protocol) destroy_protocol(protocol)
end end
my_module.user_assignments.destroy_all
my_module.delete my_module.delete
end end
@ -57,12 +58,14 @@ class UserDataDeletion
experiment.activities.destroy_all experiment.activities.destroy_all
experiment.report_elements.destroy_all experiment.report_elements.destroy_all
experiment.my_module_groups.delete_all experiment.my_module_groups.delete_all
experiment.user_assignments.destroy_all
experiment.delete experiment.delete
end end
project.user_projects.destroy_all project.user_projects.destroy_all
project.tags.destroy_all project.tags.destroy_all
project.project_comments.destroy_all project.project_comments.destroy_all
project.report_elements.destroy_all project.report_elements.destroy_all
project.user_assignments.destroy_all
project.delete project.delete
end end
@ -76,6 +79,7 @@ class UserDataDeletion
user.update(current_team_id: nil) user.update(current_team_id: nil)
end end
team.reports.destroy_all team.reports.destroy_all
team.user_assignments.destroy_all
team.destroy! team.destroy!
# raise ActiveRecord::Rollback # raise ActiveRecord::Rollback
end end
@ -93,6 +97,7 @@ class UserDataDeletion
# Destroy step # Destroy step
step.tables.destroy_all step.tables.destroy_all
step.step_tables.delete_all step.step_tables.delete_all
step.step_texts.destroy_all
step.report_elements.destroy_all step.report_elements.destroy_all
step.step_comments.destroy_all step.step_comments.destroy_all
step.step_assets.destroy_all step.step_assets.destroy_all
@ -104,7 +109,7 @@ class UserDataDeletion
# Destroy protocol # Destroy protocol
protocol.protocol_protocol_keywords.destroy_all protocol.protocol_protocol_keywords.destroy_all
protocol.protocol_keywords.destroy_all protocol.protocol_keywords.destroy_all
protocol.delete protocol.destroy
end end
def self.destroy_notifications(user) def self.destroy_notifications(user)