chore: clean some dead code
This commit is contained in:
parent
084a68a121
commit
a8e605f4b3
2 changed files with 0 additions and 38 deletions
|
@ -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
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue