aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlban Peignier2018-05-09 15:41:06 +0200
committerAlban Peignier2018-05-09 15:41:06 +0200
commitd0ab0eb848a96587ac0e0ab26db962c15e559185 (patch)
treec6fbe30673b7bffac514b6e264b228bed5b7311d
parent9684831ac650d633ddfab1062e2285f9482b1157 (diff)
downloadchouette-core-d0ab0eb848a96587ac0e0ab26db962c15e559185.tar.bz2
Associate ComplianceControlSet with parent operation when created. Refs #6960
-rw-r--r--app/models/import/resource.rb2
-rw-r--r--app/workers/compliance_control_set_copy_worker.rb4
2 files changed, 4 insertions, 2 deletions
diff --git a/app/models/import/resource.rb b/app/models/import/resource.rb
index 343eb9b7d..43690755d 100644
--- a/app/models/import/resource.rb
+++ b/app/models/import/resource.rb
@@ -24,7 +24,7 @@ class Import::Resource < ApplicationModel
next unless (control_set = workbench.compliance_control_set(key)).present?
compliance_check_set = workbench_import_check_set key
if compliance_check_set.nil?
- ComplianceControlSetCopyWorker.perform_async control_set.id, referential_id
+ ComplianceControlSetCopyWorker.perform_async control_set.id, referential_id, root_import.class.name, root_import.id
end
end
end
diff --git a/app/workers/compliance_control_set_copy_worker.rb b/app/workers/compliance_control_set_copy_worker.rb
index 337b92f4b..b87f5ad8e 100644
--- a/app/workers/compliance_control_set_copy_worker.rb
+++ b/app/workers/compliance_control_set_copy_worker.rb
@@ -1,8 +1,10 @@
class ComplianceControlSetCopyWorker
include Sidekiq::Worker
- def perform(control_set_id, referential_id)
+ def perform(control_set_id, referential_id, parent_type = nil, parent_id = nil)
check_set = ComplianceControlSetCopier.new.copy(control_set_id, referential_id)
+ check_set.update parent_type: parent_type, parent_id: parent_id if parent_type && parent_id
+
begin
Net::HTTP.get(URI("#{Rails.configuration.iev_url}/boiv_iev/referentials/validator/new?id=#{check_set.id}"))
rescue Exception => e