From 9527d19ae7ec674501c691aebdb0dfc84d041227 Mon Sep 17 00:00:00 2001 From: Martin Date: Mon, 16 Oct 2023 17:20:17 +0200 Subject: [PATCH] amelioration(data_fixer.rake): ajoute la tache pour fixer les champs manquant a un dossier --- lib/tasks/data_fixer.rake | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/tasks/data_fixer.rake b/lib/tasks/data_fixer.rake index b7b53fe65..19d70d9b8 100644 --- a/lib/tasks/data_fixer.rake +++ b/lib/tasks/data_fixer.rake @@ -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