From 6a3f7438d5a513ce3d2564e2427f8d3fba619b03 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Tue, 9 Oct 2018 20:06:11 +0200 Subject: [PATCH] [#2772] Let migrator instantiate mapping from provided class --- lib/tasks/2018_07_31_nutriscore.rake | 2 +- lib/tasks/dossier_procedure_migrator.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/2018_07_31_nutriscore.rake b/lib/tasks/2018_07_31_nutriscore.rake index 0f4b86793..f69c1b57a 100644 --- a/lib/tasks/2018_07_31_nutriscore.rake +++ b/lib/tasks/2018_07_31_nutriscore.rake @@ -100,7 +100,7 @@ namespace :'2018_07_31_nutriscore' do target_tdc.champ.create(dossier: d, value: JSON.unparse(['FRANCE'])) end end - end.new(source_procedure, destination_procedure) + end Tasks::DossierProcedureMigrator.new(source_procedure, destination_procedure, mapping).migrate_procedure AutoReceiveDossiersForProcedureJob.set(cron: "* * * * *").perform_later(destination_procedure_id, 'accepte') diff --git a/lib/tasks/dossier_procedure_migrator.rb b/lib/tasks/dossier_procedure_migrator.rb index 380a8f016..6bbe22cee 100644 --- a/lib/tasks/dossier_procedure_migrator.rb +++ b/lib/tasks/dossier_procedure_migrator.rb @@ -117,7 +117,7 @@ module Tasks def initialize(source_procedure, destination_procedure, champ_mapping) @source_procedure = source_procedure @destination_procedure = destination_procedure - @champ_mapping = champ_mapping + @champ_mapping = champ_mapping.new(source_procedure, destination_procedure) end def migrate_procedure