Merge pull request #6210 from betagouv/fix_display_champ_in_projection_service
Corrige un mauvais affichage de champ dans le tableau de bord d'une procédure
This commit is contained in:
commit
2c97f123a1
2 changed files with 12 additions and 1 deletions
|
@ -33,7 +33,7 @@ class DossierProjectionService
|
|||
types_de_champ: { stable_id: fields.map { |f| f[COLUMN] } },
|
||||
dossier_id: dossiers_ids
|
||||
)
|
||||
.select(:dossier_id, :value, :type_de_champ_id, :stable_id) # we cannot pluck :value, as we need the champ.to_s method
|
||||
.select(:dossier_id, :value, :type_de_champ_id, :stable_id, :type) # we cannot pluck :value, as we need the champ.to_s method
|
||||
.group_by(&:stable_id) # the champs are redispatched to their respective fields
|
||||
.map do |stable_id, champs|
|
||||
field = fields.find { |f| f[COLUMN] == stable_id.to_s }
|
||||
|
|
|
@ -162,6 +162,17 @@ describe DossierProjectionService do
|
|||
|
||||
it { is_expected.to eq('quinoa') }
|
||||
end
|
||||
|
||||
context 'for type_de_champ table and value to.s' do
|
||||
let(:table) { 'type_de_champ' }
|
||||
let(:procedure) { create(:procedure, :with_yes_no) }
|
||||
let(:dossier) { create(:dossier, procedure: procedure) }
|
||||
let(:column) { dossier.procedure.types_de_champ.first.stable_id.to_s }
|
||||
|
||||
before { dossier.champs.first.update(value: 'true') }
|
||||
|
||||
it { is_expected.to eq('Oui') }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue