fix(champ): do not expose champs without row_id in repetitions

This commit is contained in:
Paul Chavard 2024-04-02 17:51:57 +02:00
parent 2ea45d5dba
commit 7cf1cdb47b

View file

@ -1158,10 +1158,15 @@ class Dossier < ApplicationRecord
.transform_values { _1.sort_by(&:id).uniq(&:row_id) } .transform_values { _1.sort_by(&:id).uniq(&:row_id) }
if scope.is_a?(TypeDeChamp) if scope.is_a?(TypeDeChamp)
revision.children_of(scope) revision
.children_of(scope)
.flat_map { champs_index[_1.stable_id] || [] }
.filter(&:child?)
else else
revision.types_de_champ_for(scope:, root:) revision
end.flat_map { champs_index[_1.stable_id] || [] } .types_de_champ_for(scope:, root:)
.flat_map { champs_index[_1.stable_id] || [] }
end
end end
def has_annotations? def has_annotations?