[Fix #2874] Allow archived dossiers to appear in search results

This commit is contained in:
Frederic Merizen 2018-10-18 15:21:13 +02:00
parent f35f2d3b45
commit 447e54fe45
2 changed files with 7 additions and 2 deletions

View file

@ -32,7 +32,6 @@ class DossierSearchService
gestionnaire gestionnaire
.dossiers .dossiers
.not_archived
.state_not_brouillon .state_not_brouillon
.where("#{ts_vector} @@ #{ts_query}") .where("#{ts_vector} @@ #{ts_query}")
.order("COALESCE(ts_rank(#{ts_vector}, #{ts_query}), 0) DESC") .order("COALESCE(ts_rank(#{ts_vector}, #{ts_query}), 0) DESC")

View file

@ -33,7 +33,7 @@ describe DossierSearchService do
let!(:etablissement_3) { create(:etablissement, entreprise_raison_sociale: 'OCTO Technology', siret: '41816609600051') } let!(:etablissement_3) { create(:etablissement, entreprise_raison_sociale: 'OCTO Technology', siret: '41816609600051') }
let!(:dossier_3) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_2, user: create(:user, email: 'peace@clap.fr'), etablissement: etablissement_3) } let!(:dossier_3) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_2, user: create(:user, email: 'peace@clap.fr'), etablissement: etablissement_3) }
let!(:dossier_archived) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_1, archived: true, user: create(:user, email: 'brouillonArchived@clap.fr')) } let!(:dossier_archived) { create(:dossier, state: Dossier.states.fetch(:en_construction), procedure: procedure_1, archived: true, user: create(:user, email: 'archived@clap.fr')) }
describe 'search is empty' do describe 'search is empty' do
let(:terms) { '' } let(:terms) { '' }
@ -47,6 +47,12 @@ describe DossierSearchService do
it { expect(subject.size).to eq(0) } it { expect(subject.size).to eq(0) }
end end
describe 'search archived file' do
let(:terms) { 'archived' }
it { expect(subject.size).to eq(1) }
end
describe 'search on contact email' do describe 'search on contact email' do
let(:terms) { 'clap' } let(:terms) { 'clap' }