[#3356] Simplify detection of handling champ

This commit is contained in:
Frederic Merizen 2019-02-05 14:44:23 +01:00 committed by simon lehericey
parent bcfc0f2535
commit 140a65cb36

View file

@ -196,8 +196,7 @@ module TagsSubstitutionConcern
def replace_type_de_champ_tags(text, types_de_champ, dossier_champs) def replace_type_de_champ_tags(text, types_de_champ, dossier_champs)
types_de_champ.inject(text) do |acc, tag| types_de_champ.inject(text) do |acc, tag|
champ = dossier_champs champ = dossier_champs
.select { |dossier_champ| dossier_champ.libelle == tag[:libelle] } .detect { |dossier_champ| dossier_champ.libelle == tag[:libelle] }
.first
replace_tag(acc, tag, champ) replace_tag(acc, tag, champ)
end end