forgive space in query

This commit is contained in:
simon lehericey 2024-11-29 21:32:08 +01:00
parent 0b99f6c847
commit 1b1626baaa
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5
2 changed files with 2 additions and 2 deletions

View file

@ -29,7 +29,7 @@ module DossierFilteringConcern
}
scope :filter_ilike, lambda { |table, column, search_terms|
safe_quoted_terms = search_terms.map { "%#{sanitize_sql_like(_1)}%" }
safe_quoted_terms = search_terms.map(&:strip).map { "%#{sanitize_sql_like(_1)}%" }
table_column = DossierFilterService.sanitized_column(table, column)
where("#{table_column} LIKE ANY (ARRAY[?])", safe_quoted_terms)

View file

@ -443,7 +443,7 @@ describe DossierFilterService do
end
context 'for type_de_champ table' do
let(:filter) { [type_de_champ.libelle, 'keep'] }
let(:filter) { [type_de_champ.libelle, ' keep '] }
let(:kept_dossier) { create(:dossier, procedure:) }
let(:discarded_dossier) { create(:dossier, procedure:) }