diff --git a/app/controllers/administrateurs/groupe_instructeurs_controller.rb b/app/controllers/administrateurs/groupe_instructeurs_controller.rb index aa422b281..b3a4e9f92 100644 --- a/app/controllers/administrateurs/groupe_instructeurs_controller.rb +++ b/app/controllers/administrateurs/groupe_instructeurs_controller.rb @@ -41,7 +41,7 @@ module Administrateurs @procedure = procedure stable_id = params[:create_simple_routing][:stable_id].to_i - tdc = @procedure.active_revision.routable_types_de_champ.find { |tdc| tdc.stable_id == stable_id } + tdc = @procedure.active_revision.simple_routable_types_de_champ.find { |tdc| tdc.stable_id == stable_id } case tdc.type_champ when TypeDeChamp.type_champs.fetch(:departements) diff --git a/app/models/procedure_revision.rb b/app/models/procedure_revision.rb index 709ae8472..22b4d3ed6 100644 --- a/app/models/procedure_revision.rb +++ b/app/models/procedure_revision.rb @@ -265,8 +265,8 @@ class ProcedureRevision < ApplicationRecord [coordinate, coordinate&.type_de_champ] end - def routable_types_de_champ - types_de_champ_public.filter(&:routable?) + def simple_routable_types_de_champ + types_de_champ_public.filter(&:simple_routable?) end def conditionable_types_de_champ diff --git a/app/models/type_de_champ.rb b/app/models/type_de_champ.rb index abc959a7b..52fc141b0 100644 --- a/app/models/type_de_champ.rb +++ b/app/models/type_de_champ.rb @@ -110,7 +110,7 @@ class TypeDeChamp < ApplicationRecord expression_reguliere: 'expression_reguliere' } - ROUTABLE_TYPES = [ + SIMPLE_ROUTABLE_TYPES = [ type_champs.fetch(:drop_down_list), type_champs.fetch(:communes), type_champs.fetch(:departements), @@ -652,8 +652,8 @@ class TypeDeChamp < ApplicationRecord end end - def routable? - type_champ.in?(ROUTABLE_TYPES) + def simple_routable? + type_champ.in?(SIMPLE_ROUTABLE_TYPES) end def conditionable? diff --git a/app/views/administrateurs/groupe_instructeurs/simple_routing.html.haml b/app/views/administrateurs/groupe_instructeurs/simple_routing.html.haml index 854ef9c18..c1a97daa0 100644 --- a/app/views/administrateurs/groupe_instructeurs/simple_routing.html.haml +++ b/app/views/administrateurs/groupe_instructeurs/simple_routing.html.haml @@ -15,7 +15,7 @@ %div{ data: { 'action': "click->enable-submit-if-checked#click" } } .notice Sélectionner le champ à partir duquel créer des groupes d’instructeurs - - buttons_content = @procedure.active_revision.routable_types_de_champ.map { |tdc| { label: tdc.libelle, value: tdc.stable_id } } + - buttons_content = @procedure.active_revision.simple_routable_types_de_champ.map { |tdc| { label: tdc.libelle, value: tdc.stable_id } } = render Dsfr::RadioButtonListComponent.new(form: f, target: :stable_id, buttons: buttons_content) diff --git a/spec/lib/tasks/re_routing_dossiers_spec.rb b/spec/lib/tasks/re_routing_dossiers_spec.rb index dd31215b5..c0e2d4948 100644 --- a/spec/lib/tasks/re_routing_dossiers_spec.rb +++ b/spec/lib/tasks/re_routing_dossiers_spec.rb @@ -12,7 +12,7 @@ describe 're_routing_dossiers' do dossier2.champs.last.update(value: 'Allier') - tdc = procedure.active_revision.routable_types_de_champ.first + tdc = procedure.active_revision.simple_routable_types_de_champ.first tdc_options = APIGeoService.departements.map { ["#{_1[:code]} – #{_1[:name]}", _1[:code]] } diff --git a/spec/models/procedure_revision_spec.rb b/spec/models/procedure_revision_spec.rb index 4b17da875..99e307b21 100644 --- a/spec/models/procedure_revision_spec.rb +++ b/spec/models/procedure_revision_spec.rb @@ -1144,7 +1144,7 @@ describe ProcedureRevision do } end - describe '#routable_types_de_champ' do + describe '#simple_routable_types_de_champ' do let(:procedure) do create(:procedure, types_de_champ_public: [ { type: :text, libelle: 'l1' }, @@ -1156,6 +1156,6 @@ describe ProcedureRevision do ]) end - it { expect(draft.routable_types_de_champ.pluck(:libelle)).to eq(['l2', 'l3', 'l4', 'l5', 'l6']) } + it { expect(draft.simple_routable_types_de_champ.pluck(:libelle)).to eq(['l2', 'l3', 'l4', 'l5', 'l6']) } end end