Remove FC fields from instructeur table customisation
This commit is contained in:
parent
5107b33af8
commit
12f0c99b5a
5 changed files with 0 additions and 51 deletions
|
@ -240,8 +240,6 @@ module NewGestionnaire
|
||||||
end
|
end
|
||||||
end.each do |group_key, fields|
|
end.each do |group_key, fields|
|
||||||
case group_key
|
case group_key
|
||||||
when 'france_connect_information'
|
|
||||||
@dossiers = @dossiers.includes({ user: :france_connect_information })
|
|
||||||
when 'type_de_champ_group'
|
when 'type_de_champ_group'
|
||||||
if fields.any? { |field| field['table'] == 'type_de_champ' }
|
if fields.any? { |field| field['table'] == 'type_de_champ' }
|
||||||
@dossiers = @dossiers.includes(:champs).references(:champs)
|
@dossiers = @dossiers.includes(:champs).references(:champs)
|
||||||
|
|
|
@ -9,12 +9,6 @@ class DossierFieldService
|
||||||
field_hash('Demandeur', 'user', 'email')
|
field_hash('Demandeur', 'user', 'email')
|
||||||
]
|
]
|
||||||
|
|
||||||
fields.push(
|
|
||||||
field_hash('Civilité (FC)', 'france_connect_information', 'gender'),
|
|
||||||
field_hash('Prénom (FC)', 'france_connect_information', 'given_name'),
|
|
||||||
field_hash('Nom (FC)', 'france_connect_information', 'family_name')
|
|
||||||
)
|
|
||||||
|
|
||||||
if !procedure.for_individual || (procedure.for_individual && procedure.individual_with_siret)
|
if !procedure.for_individual || (procedure.for_individual && procedure.individual_with_siret)
|
||||||
fields.push(
|
fields.push(
|
||||||
field_hash('SIREN', 'etablissement', 'entreprise_siren'),
|
field_hash('SIREN', 'etablissement', 'entreprise_siren'),
|
||||||
|
@ -53,8 +47,6 @@ class DossierFieldService
|
||||||
dossier.send(column)
|
dossier.send(column)
|
||||||
when 'user'
|
when 'user'
|
||||||
dossier.user.send(column)
|
dossier.user.send(column)
|
||||||
when 'france_connect_information'
|
|
||||||
dossier.user.france_connect_information&.send(column)
|
|
||||||
when 'etablissement'
|
when 'etablissement'
|
||||||
dossier.etablissement&.send(column)
|
dossier.etablissement&.send(column)
|
||||||
when 'type_de_champ'
|
when 'type_de_champ'
|
||||||
|
@ -82,11 +74,6 @@ class DossierFieldService
|
||||||
when 'self'
|
when 'self'
|
||||||
dossiers.where("? ILIKE ?", filter['column'], "%#{filter['value']}%")
|
dossiers.where("? ILIKE ?", filter['column'], "%#{filter['value']}%")
|
||||||
|
|
||||||
when 'france_connect_information'
|
|
||||||
dossiers
|
|
||||||
.includes(user: :france_connect_information)
|
|
||||||
.where("? ILIKE ?", "france_connect_informations.#{filter['column']}", "%#{filter['value']}%")
|
|
||||||
|
|
||||||
when 'type_de_champ', 'type_de_champ_private'
|
when 'type_de_champ', 'type_de_champ_private'
|
||||||
relation = table == 'type_de_champ' ? :champs : :champs_private
|
relation = table == 'type_de_champ' ? :champs : :champs_private
|
||||||
dossiers
|
dossiers
|
||||||
|
@ -133,11 +120,6 @@ class DossierFieldService
|
||||||
return dossiers
|
return dossiers
|
||||||
.order("#{column} #{order}")
|
.order("#{column} #{order}")
|
||||||
.pluck(:id)
|
.pluck(:id)
|
||||||
when 'france_connect_information'
|
|
||||||
return dossiers
|
|
||||||
.includes(user: :france_connect_information)
|
|
||||||
.order("#{column} #{order}")
|
|
||||||
.pluck(:id)
|
|
||||||
when 'type_de_champ', 'type_de_champ_private'
|
when 'type_de_champ', 'type_de_champ_private'
|
||||||
return dossiers
|
return dossiers
|
||||||
.includes(table == 'type_de_champ' ? :champs : :champs_private)
|
.includes(table == 'type_de_champ' ? :champs : :champs_private)
|
||||||
|
|
|
@ -749,7 +749,6 @@ describe Dossier do
|
||||||
|
|
||||||
it { expect(dossier.get_value('self', 'created_at')).to eq(dossier.created_at) }
|
it { expect(dossier.get_value('self', 'created_at')).to eq(dossier.created_at) }
|
||||||
it { expect(dossier.get_value('user', 'email')).to eq(user.email) }
|
it { expect(dossier.get_value('user', 'email')).to eq(user.email) }
|
||||||
it { expect(dossier.get_value('france_connect_information', 'gender')).to eq(user.france_connect_information.gender) }
|
|
||||||
it { expect(dossier.get_value('etablissement', 'entreprise_siren')).to eq(dossier.etablissement.entreprise_siren) }
|
it { expect(dossier.get_value('etablissement', 'entreprise_siren')).to eq(dossier.etablissement.entreprise_siren) }
|
||||||
it { expect(dossier.get_value('etablissement', 'siret')).to eq(dossier.etablissement.siret) }
|
it { expect(dossier.get_value('etablissement', 'siret')).to eq(dossier.etablissement.siret) }
|
||||||
it { expect(dossier.get_value('type_de_champ', @champ_public.type_de_champ.id.to_s)).to eq(dossier.champs.first.value) }
|
it { expect(dossier.get_value('type_de_champ', @champ_public.type_de_champ.id.to_s)).to eq(dossier.champs.first.value) }
|
||||||
|
|
|
@ -639,9 +639,6 @@ describe Procedure do
|
||||||
{ "label" => 'Créé le', "table" => 'self', "column" => 'created_at' },
|
{ "label" => 'Créé le', "table" => 'self', "column" => 'created_at' },
|
||||||
{ "label" => 'Mis à jour le', "table" => 'self', "column" => 'updated_at' },
|
{ "label" => 'Mis à jour le', "table" => 'self', "column" => 'updated_at' },
|
||||||
{ "label" => 'Demandeur', "table" => 'user', "column" => 'email' },
|
{ "label" => 'Demandeur', "table" => 'user', "column" => 'email' },
|
||||||
{ "label" => 'Civilité (FC)', "table" => 'france_connect_information', "column" => 'gender' },
|
|
||||||
{ "label" => 'Prénom (FC)', "table" => 'france_connect_information', "column" => 'given_name' },
|
|
||||||
{ "label" => 'Nom (FC)', "table" => 'france_connect_information', "column" => 'family_name' },
|
|
||||||
{ "label" => 'SIREN', "table" => 'etablissement', "column" => 'entreprise_siren' },
|
{ "label" => 'SIREN', "table" => 'etablissement', "column" => 'entreprise_siren' },
|
||||||
{ "label" => 'Forme juridique', "table" => 'etablissement', "column" => 'entreprise_forme_juridique' },
|
{ "label" => 'Forme juridique', "table" => 'etablissement', "column" => 'entreprise_forme_juridique' },
|
||||||
{ "label" => 'Nom commercial', "table" => 'etablissement', "column" => 'entreprise_nom_commercial' },
|
{ "label" => 'Nom commercial', "table" => 'etablissement', "column" => 'entreprise_nom_commercial' },
|
||||||
|
|
|
@ -118,22 +118,6 @@ describe DossierFieldService do
|
||||||
it { is_expected.to eq([older_dossier, recent_dossier].map(&:id)) }
|
it { is_expected.to eq([older_dossier, recent_dossier].map(&:id)) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for france_connect_information table' do
|
|
||||||
let(:table) { 'france_connect_information' }
|
|
||||||
let(:column) { 'given_name' } # All other columns work the same, no extra test required
|
|
||||||
let(:order) { 'asc' } # Desc works the same, no extra test required
|
|
||||||
|
|
||||||
let(:anna_dossier) { create(:dossier, procedure: procedure) }
|
|
||||||
let(:zacharie_dossier) { create(:dossier, procedure: procedure) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
create(:france_connect_information, given_name: 'Anna', user: anna_dossier.user)
|
|
||||||
create(:france_connect_information, given_name: 'Zacharie', user: zacharie_dossier.user)
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.to eq([anna_dossier, zacharie_dossier].map(&:id)) }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'for type_de_champ table' do
|
context 'for type_de_champ table' do
|
||||||
let(:table) { 'type_de_champ' }
|
let(:table) { 'type_de_champ' }
|
||||||
let(:column) { procedure.types_de_champ.first.id.to_s }
|
let(:column) { procedure.types_de_champ.first.id.to_s }
|
||||||
|
@ -202,17 +186,6 @@ describe DossierFieldService do
|
||||||
it { is_expected.to eq('bla@yopmail.com') }
|
it { is_expected.to eq('bla@yopmail.com') }
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for france_connect_information table' do
|
|
||||||
let(:table) { 'france_connect_information' }
|
|
||||||
let(:column) { 'given_name' } # All other columns work the same, no extra test required
|
|
||||||
|
|
||||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
|
||||||
|
|
||||||
before { create(:france_connect_information, given_name: 'Anna', user: dossier.user) }
|
|
||||||
|
|
||||||
it { is_expected.to eq('Anna') }
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'for etablissement table' do
|
context 'for etablissement table' do
|
||||||
let(:table) { 'etablissement' }
|
let(:table) { 'etablissement' }
|
||||||
let(:column) { 'code_postal' } # All other columns work the same, no extra test required
|
let(:column) { 'code_postal' } # All other columns work the same, no extra test required
|
||||||
|
|
Loading…
Reference in a new issue