diff --git a/app/tasks/maintenance/fix_missing_champs_task.rb b/app/tasks/maintenance/fix_missing_champs_task.rb deleted file mode 100644 index c7c92eb1ac5..00000000000 --- a/app/tasks/maintenance/fix_missing_champs_task.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true - -# bundle exec maintenance_tasks perform Maintenance::FixMissingChampsTask --arguments procedure_ids:id1,id2,id3 -module Maintenance - class FixMissingChampsTask < MaintenanceTasks::Task - attribute :procedure_ids, array: true, default: [] - - def collection - Dossier.joins(:procedure).where(procedure: { id: procedure_ids }).in_batches - end - - def process(dossiers) - # rubocop:disable Rails/FindEach - DossierPreloader.new(dossiers).all.each do |dossier| - # rubocop:enable Rails/FindEach - maybe_fixable = [dossier, dossier.editing_forks.first].compact.any? { _1.champs.size < _1.revision.types_de_champ.size } - if maybe_fixable - DataFixer::DossierChampsMissing.new(dossier:).fix - end - end - end - end -end diff --git a/lib/tasks/data_fixer.rake b/lib/tasks/data_fixer.rake index f4419bc8c0d..46f3dd8212c 100644 --- a/lib/tasks/data_fixer.rake +++ b/lib/tasks/data_fixer.rake @@ -28,19 +28,4 @@ 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