diff --git a/app/models/procedure_revision.rb b/app/models/procedure_revision.rb index 62eeac7d0..32b44993e 100644 --- a/app/models/procedure_revision.rb +++ b/app/models/procedure_revision.rb @@ -85,18 +85,6 @@ class ProcedureRevision < ApplicationRecord end end - def rebase_champs_repetable_parent_id - revision_types_de_champ.where.not(parent_id: nil).find_each do |champ_repetable| - if !revision_types_de_champ.exists?(id: champ_repetable.parent_id) - type_de_champ_stable_id = champ_repetable.parent.type_de_champ.stable_id - new_revision_type_de_champs_parent_id = revision_types_de_champ.joins(:type_de_champ).where(type_de_champ: { stable_id: type_de_champ_stable_id }).first&.id - if !new_revision_type_de_champs_parent_id.nil? - champ_repetable.update(parent_id: new_revision_type_de_champs_parent_id) - end - end - end - end - def remove_type_de_champ(stable_id) type_de_champ = find_type_de_champ_by_stable_id(stable_id) diff --git a/lib/tasks/deployment/20220509142256_relink_procedure_revision_types_de_champ_with_most_recent_version.rake b/lib/tasks/deployment/20220509142256_relink_procedure_revision_types_de_champ_with_most_recent_version.rake deleted file mode 100644 index b1f5e89dc..000000000 --- a/lib/tasks/deployment/20220509142256_relink_procedure_revision_types_de_champ_with_most_recent_version.rake +++ /dev/null @@ -1,16 +0,0 @@ -namespace :after_party do - desc 'Relink revision_types_de_champ repetition to current revision revision_types_de_champ' - task relink_procedure_revision_types_de_champ_with_most_recent_version: :environment do - puts "Running deploy task 'relink_procedure_revision_types_de_champ_with_most_recent_version'" - - # Put your task implementation HERE. - Procedure.joins(:revisions).group('procedures.id').having("count(procedure_revisions.id) > 1").in_batches do |procedure| - procedure.revisions.map(&:rebase_champs_repetable_parent_id) - end - - # Update task as completed. If you remove the line below, the task will - # run with every deploy (or every time you call after_party:run). - AfterParty::TaskRecord - .create version: AfterParty::TaskRecorder.new(__FILE__).timestamp - end -end