feat(update_draft_revision_type_de_champs_task): force to use real position otherwise have to process parent_coordinates...

This commit is contained in:
Martin 2024-01-18 11:03:55 +01:00 committed by mfo
parent 434cd77030
commit 5c049a1c0f
2 changed files with 4 additions and 17 deletions

View file

@ -29,8 +29,7 @@ module Maintenance
fail "TypeDeChamp not found ! #{typed_id}" if stable_id.nil?
tdc = revision.find_and_ensure_exclusive_use(stable_id)
revision.move_type_de_champ(stable_id, compute_position(row, tdc.revision_type_de_champ))
revision.move_type_de_champ(stable_id, Integer(row['new_position']))
tdc.update!(
libelle: row["new_libelle"].strip,
@ -38,17 +37,5 @@ module Maintenance
mandatory: row["new_required"] == "true"
)
end
private
def compute_position(row, rtdc)
position = Integer(row["new_position"])
if rtdc.child?
position - rtdc.parent.position - 1
else
position
end
end
end
end