diff --git a/app/components/instructeurs/column_picker_component.rb b/app/components/instructeurs/column_picker_component.rb index 296648a66..3e27ce7ab 100644 --- a/app/components/instructeurs/column_picker_component.rb +++ b/app/components/instructeurs/column_picker_component.rb @@ -12,7 +12,7 @@ class Instructeurs::ColumnPickerComponent < ApplicationComponent def displayable_columns_for_select [ procedure.columns.filter(&:displayable).map { |column| [column.label, column.id] }, - procedure_presentation.displayed_fields.map { Column.new(**_1.deep_symbolize_keys.except(:virtual)).id } # TODO: remove virtual after migration + procedure_presentation.displayed_fields.map { Column.new(**_1.deep_symbolize_keys).id } ] end end diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index bb6e6d874..7173e49e5 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -29,7 +29,7 @@ class ProcedurePresentation < ApplicationRecord def displayed_fields_for_headers [ Column.new(table: 'self', column: 'id', classname: 'number-col'), - *displayed_fields.map { Column.new(**_1.deep_symbolize_keys.except(:virtual)) }, # TODO: remove virtual after migration + *displayed_fields.map { Column.new(**_1.deep_symbolize_keys) }, Column.new(table: 'self', column: 'state', classname: 'state-col'), *procedure.sva_svr_columns ] diff --git a/spec/components/instructeurs/column_picker_component_spec.rb b/spec/components/instructeurs/column_picker_component_spec.rb index 9466b6238..13edeb9a4 100644 --- a/spec/components/instructeurs/column_picker_component_spec.rb +++ b/spec/components/instructeurs/column_picker_component_spec.rb @@ -15,9 +15,6 @@ describe Instructeurs::ColumnPickerComponent, type: :component do subject { component.displayable_columns_for_select } before do - procedure_presentation.displayed_fields.first['virtual'] = true - procedure_presentation.save - allow(procedure).to receive(:columns).and_return([ default_user_email, excluded_displayable_field diff --git a/spec/models/procedure_presentation_spec.rb b/spec/models/procedure_presentation_spec.rb index 266d2c23e..475719331 100644 --- a/spec/models/procedure_presentation_spec.rb +++ b/spec/models/procedure_presentation_spec.rb @@ -14,7 +14,7 @@ describe ProcedurePresentation do assign_to: assign_to, displayed_fields: [ { label: "test1", table: "user", column: "email" }, - { label: "test2", table: "type_de_champ", column: first_type_de_champ_id, virtual: false } + { label: "test2", table: "type_de_champ", column: first_type_de_champ_id } ], sort: { table: "user", column: "email", "order" => "asc" }, filters: filters) @@ -23,11 +23,7 @@ describe ProcedurePresentation do let(:filters) { { "a-suivre" => [], "suivis" => [{ "label" => "label1", "table" => "self", "column" => "created_at" }] } } describe "#displayed_fields" do - it { expect(procedure_presentation.displayed_fields).to eq([{ "label" => "test1", "table" => "user", "column" => "email" }, { "label" => "test2", "table" => "type_de_champ", "column" => first_type_de_champ_id, "virtual" => false }]) } - end - - describe "#displayed_fields_for_headers" do - it { expect(procedure_presentation.displayed_fields_for_headers.map(&:label)).to eq(["Nº dossier", "test1", "test2", "Statut"]) } + it { expect(procedure_presentation.displayed_fields).to eq([{ "label" => "test1", "table" => "user", "column" => "email" }, { "label" => "test2", "table" => "type_de_champ", "column" => first_type_de_champ_id }]) } end describe "#sort" do