refactor reorder: add order_place only in children

This commit is contained in:
simon lehericey 2022-05-11 16:30:42 +02:00
parent df91fd1180
commit 5d6dd853d4

View file

@ -147,10 +147,14 @@ class ProcedureRevision < ApplicationRecord
private
def reorder(siblings)
siblings.to_a.compact.each.with_index do |e, position|
e.update(position: position)
e.type_de_champ.update!(order_place: position)
end
siblings.to_a.compact.each.with_index do |sibling, position|
sibling.update(position: position)
# FIXME: to remove when order_place is no longer used
if sibling.parent_id.present?
sibling.type_de_champ.update!(order_place: position)
end
end
end
def compare_attestation_template(from_at, to_at)