Merge pull request #10256 from tchak/fix-champs-without-row_id-in-repetitions

fix(champ): do not expose champs without row_id in repetitions
This commit is contained in:
Paul Chavard 2024-04-02 16:48:27 +00:00 committed by GitHub
commit 6e78dc60cd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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?) # TODO: remove once bad data (child champ without a row id) is cleaned
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?