diff --git a/Gemfile.lock b/Gemfile.lock index ac1c5d752..9a3451400 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -428,7 +428,7 @@ GEM mimemagic (0.3.5) mini_magick (4.11.0) mini_mime (1.0.2) - mini_portile2 (2.4.0) + mini_portile2 (2.5.0) minitest (5.14.2) momentjs-rails (2.20.1) railties (>= 3.1) @@ -439,8 +439,9 @@ GEM nenv (0.3.0) netrc (0.11.0) nio4r (2.5.4) - nokogiri (1.10.10) - mini_portile2 (~> 2.4.0) + nokogiri (1.11.1) + mini_portile2 (~> 2.5.0) + racc (~> 1.4) notiffany (0.1.3) nenv (~> 0.1) shellany (~> 0.0) @@ -494,6 +495,7 @@ GEM pundit (2.1.0) activesupport (>= 3.0.0) raabro (1.1.6) + racc (1.5.2) rack (2.2.3) rack-attack (6.3.1) rack (>= 1.0, < 3) diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index 68453285a..aeed93e2d 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -57,7 +57,7 @@ class TypeDeChamp < ApplicationRecord belongs_to :parent, class_name: 'TypeDeChamp', optional: true has_many :types_de_champ, -> { ordered }, foreign_key: :parent_id, class_name: 'TypeDeChamp', inverse_of: :parent, dependent: :destroy - store_accessor :options, :cadastres, :old_pj, :drop_down_options, :skip_pj_validation + store_accessor :options, :cadastres, :old_pj, :drop_down_options, :skip_pj_validation, :skip_content_type_pj_validation has_many :revision_types_de_champ, class_name: 'ProcedureRevisionTypeDeChamp', dependent: :destroy, inverse_of: :type_de_champ has_many :revisions, through: :revision_types_de_champ diff --git a/lib/tasks/deployment/20210118084107_add_default_skip_content_type_validation_to_piece_justificative.rake b/lib/tasks/deployment/20210118084107_add_default_skip_content_type_validation_to_piece_justificative.rake new file mode 100644 index 000000000..3cf0df028 --- /dev/null +++ b/lib/tasks/deployment/20210118084107_add_default_skip_content_type_validation_to_piece_justificative.rake @@ -0,0 +1,18 @@ +namespace :after_party do + desc 'Deployment task: add_default_skip_content_type_validation_to_piece_justificative' + task add_default_skip_content_type_validation_to_piece_justificative: :environment do + puts "Running deploy task 'add_default_skip_content_type_validation_to_piece_justificative'" + tdcs = TypeDeChamp.where(type_champ: TypeDeChamp.type_champs.fetch(:piece_justificative)) + progress = ProgressReport.new(tdcs.count) + tdcs.find_each do |tdc| + tdc.update(skip_content_type_pj_validation: true) + progress.inc + end + progress.finish + + # 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