From 6da717a2b92cbd7ae78bf361dd2017806c579c83 Mon Sep 17 00:00:00 2001 From: simon lehericey Date: Fri, 29 Nov 2024 21:56:14 +0100 Subject: [PATCH] forgive case in query --- app/models/concerns/dossier_filtering_concern.rb | 2 +- spec/services/dossier_filter_service_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/dossier_filtering_concern.rb b/app/models/concerns/dossier_filtering_concern.rb index 062f5fab3..f1f01a6cf 100644 --- a/app/models/concerns/dossier_filtering_concern.rb +++ b/app/models/concerns/dossier_filtering_concern.rb @@ -32,7 +32,7 @@ module DossierFilteringConcern 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) + where("#{table_column} ILIKE ANY (ARRAY[?])", safe_quoted_terms) } def sanitize_sql_like(q) = ActiveRecord::Base.sanitize_sql_like(q) diff --git a/spec/services/dossier_filter_service_spec.rb b/spec/services/dossier_filter_service_spec.rb index 5a6983c0e..21b4bdeda 100644 --- a/spec/services/dossier_filter_service_spec.rb +++ b/spec/services/dossier_filter_service_spec.rb @@ -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:) }