diff --git a/app/models/procedure_presentation.rb b/app/models/procedure_presentation.rb index 1d2134e9c..d606554c8 100644 --- a/app/models/procedure_presentation.rb +++ b/app/models/procedure_presentation.rb @@ -117,6 +117,7 @@ class ProcedurePresentation < ApplicationRecord 'value' => value } + filters_for(statut) << { id: h_id, filter: value } update(filters: updated_filters) end end diff --git a/spec/models/procedure_presentation_spec.rb b/spec/models/procedure_presentation_spec.rb index 5754b80da..f02e8b97c 100644 --- a/spec/models/procedure_presentation_spec.rb +++ b/spec/models/procedure_presentation_spec.rb @@ -862,6 +862,10 @@ describe ProcedurePresentation do { "label" => first_type_de_champ.libelle, "table" => "type_de_champ", "column" => first_type_de_champ_id, "value" => "true", "value_column" => "value" } ] }) + + suivis = procedure_presentation.suivis_filters.map { [_1['id'], _1['filter']] } + + expect(suivis).to eq([[{ "column_id" => "type_de_champ/#{first_type_de_champ_id}", "procedure_id" => procedure.id }, "true"]]) end end