fix(instructeur): can filter by avis answer
This commit is contained in:
parent
3620cbadda
commit
ff8fba3725
4 changed files with 18 additions and 5 deletions
|
@ -61,7 +61,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
field_hash('user', 'email', type: :text),
|
||||
field_hash('followers_instructeurs', 'email', type: :text),
|
||||
field_hash('groupe_instructeur', 'id', type: :enum),
|
||||
field_hash('avis', 'id', type: :text)
|
||||
field_hash('avis', 'answer', type: :text)
|
||||
)
|
||||
|
||||
if procedure.for_individual
|
||||
|
@ -211,7 +211,7 @@ class ProcedurePresentation < ApplicationRecord
|
|||
.includes(:followers_instructeurs)
|
||||
.joins('INNER JOIN users instructeurs_users ON instructeurs_users.id = instructeurs.user_id')
|
||||
.filter_ilike('instructeurs_users', :email, values)
|
||||
when 'user', 'individual'
|
||||
when 'user', 'individual', 'avis'
|
||||
dossiers
|
||||
.includes(table)
|
||||
.filter_ilike(table, column, values)
|
||||
|
|
|
@ -29,7 +29,7 @@ en:
|
|||
nom: Last name
|
||||
gender: Title
|
||||
avis:
|
||||
id: Opinion
|
||||
answer: Opinion
|
||||
etablissement:
|
||||
entreprise_siren: SIREN
|
||||
entreprise_forme_juridique: Forme juridique
|
||||
|
|
|
@ -29,7 +29,7 @@ fr:
|
|||
nom: Nom
|
||||
gender: Civilité
|
||||
avis:
|
||||
id: Avis
|
||||
answer: Avis
|
||||
etablissement:
|
||||
entreprise_siren: SIREN
|
||||
entreprise_forme_juridique: Forme juridique
|
||||
|
|
|
@ -73,7 +73,7 @@ describe ProcedurePresentation do
|
|||
{ "label" => 'Demandeur', "table" => 'user', "column" => 'email', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'Email instructeur', "table" => 'followers_instructeurs', "column" => 'email', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'Groupe instructeur', "table" => 'groupe_instructeur', "column" => 'id', 'classname' => '', 'virtual' => false, 'type' => :enum, "scope" => '' },
|
||||
{ "label" => 'Avis', "table" => 'avis', "column" => 'id', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'Avis', "table" => 'avis', "column" => 'answer', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'SIREN', "table" => 'etablissement', "column" => 'entreprise_siren', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'Forme juridique', "table" => 'etablissement', "column" => 'entreprise_forme_juridique', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
{ "label" => 'Nom commercial', "table" => 'etablissement', "column" => 'entreprise_nom_commercial', 'classname' => '', 'virtual' => false, 'type' => :text, "scope" => '' },
|
||||
|
@ -706,6 +706,19 @@ describe ProcedurePresentation do
|
|||
end
|
||||
end
|
||||
|
||||
context 'for avis table' do
|
||||
let(:procedure) { create(:procedure, :for_individual) }
|
||||
let!(:kept_dossier) { create(:dossier, procedure:) }
|
||||
let!(:discarded_dossier) { create(:dossier, procedure:) }
|
||||
let!(:avis) { create(:avis, :with_answer, dossier: kept_dossier) }
|
||||
|
||||
context 'for answer column' do
|
||||
let(:filter) { [{ 'table' => 'avis', 'column' => 'answer', 'value' => 'Pertinente' }] }
|
||||
|
||||
it { is_expected.to contain_exactly(kept_dossier.id) }
|
||||
end
|
||||
end
|
||||
|
||||
context 'for followers_instructeurs table' do
|
||||
let(:filter) { [{ 'table' => 'followers_instructeurs', 'column' => 'email', 'value' => 'keepmail' }] }
|
||||
|
||||
|
|
Loading…
Reference in a new issue