chore: clean some dead code

This commit is contained in:
Paul Chavard 2024-09-27 11:35:29 +02:00
parent 084a68a121
commit a8e605f4b3
No known key found for this signature in database
2 changed files with 0 additions and 38 deletions

View file

@ -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

View file

@ -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