refactor(tags_substitution): simplify

This commit is contained in:
simon lehericey 2024-05-15 09:30:38 +02:00
parent d60e7906e0
commit 420520489d
No known key found for this signature in database
GPG key ID: CDE670D827C7B3C5

View file

@ -284,13 +284,10 @@ module TagsSubstitutionConcern
@escape_unsafe_tags = escape
if @flat_tags.nil?
@flat_tags = available_tags(dossier).each_with_object({}) do |tags, result|
valid_tags = tags_for_dossier_state(tags)
valid_tags.each do |tag|
result[tag[:id]] = tag
end
end
@flat_tags = available_tags(dossier)
.flatten
.then { tags_for_dossier_state(_1) }
.index_by { _1[:id] }
end
tags_and_libelles.each_with_object({}) do |(tag_id, libelle), substitutions|