amelioration(data_fixer.rake): ajoute la tache pour fixer les champs manquant a un dossier

This commit is contained in:
Martin 2023-10-16 17:20:17 +02:00
parent e31347d1bf
commit 9527d19ae7

View file

@ -26,4 +26,19 @@ namespace :data_fixer do
end
end
end
desc <<~EOD
Given a dossier_id in argument, run the DossierChampsMissing.
ex: rails data_fixer:dossier_missing_champ\[1\]
EOD
task :dossier_missing_champ, [:dossier_id] => :environment do |_t, args|
dossier = Dossier.find(args[:dossier_id])
result = DataFixer::DossierChampsMissing.new(dossier:).fix
if result > 0
rake_puts "Dossier#[#{args[:dossier_id]}] fixed"
else
rake_puts "Dossier#[#{args[:dossier_id]}] not fixed"
end
end
end