Merge pull request #7833 from betagouv/fix_filter_on_multiple_state
fix(instructeur dashboard): permets de filtrer les dossiers sur plusieurs états
This commit is contained in:
commit
a90c8ae02b
2 changed files with 18 additions and 1 deletions
|
@ -182,7 +182,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
|
||||
dossiers.filter_by_datetimes(column, dates)
|
||||
else
|
||||
dossiers.where("dossiers.#{column} = ?", values)
|
||||
dossiers.where("dossiers.#{column} IN (?)", values)
|
||||
end
|
||||
when TYPE_DE_CHAMP
|
||||
dossiers.with_type_de_champ(column)
|
||||
|
|
|
@ -487,6 +487,23 @@ describe ProcedurePresentation do
|
|||
is_expected.to contain_exactly(kept_dossier.id, other_kept_dossier.id)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with multiple state filters' do
|
||||
let(:filter) do
|
||||
[
|
||||
{ 'table' => 'self', 'column' => 'state', 'value' => 'en_construction' },
|
||||
{ 'table' => 'self', 'column' => 'state', 'value' => 'en_instruction' }
|
||||
]
|
||||
end
|
||||
|
||||
let!(:kept_dossier) { create(:dossier, :en_construction, procedure: procedure) }
|
||||
let!(:other_kept_dossier) { create(:dossier, :en_instruction, procedure: procedure) }
|
||||
let!(:discarded_dossier) { create(:dossier, :accepte, procedure: procedure) }
|
||||
|
||||
it 'returns every dossier that matches any of the search criteria for a given column' do
|
||||
is_expected.to contain_exactly(kept_dossier.id, other_kept_dossier.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'for type_de_champ table' do
|
||||
|
|
Loading…
Reference in a new issue