feat(update_draft_revision_type_de_champs_task): force to use real position otherwise have to process parent_coordinates...
This commit is contained in:
parent
434cd77030
commit
5c049a1c0f
2 changed files with 4 additions and 17 deletions
|
@ -29,8 +29,7 @@ module Maintenance
|
||||||
fail "TypeDeChamp not found ! #{typed_id}" if stable_id.nil?
|
fail "TypeDeChamp not found ! #{typed_id}" if stable_id.nil?
|
||||||
|
|
||||||
tdc = revision.find_and_ensure_exclusive_use(stable_id)
|
tdc = revision.find_and_ensure_exclusive_use(stable_id)
|
||||||
|
revision.move_type_de_champ(stable_id, Integer(row['new_position']))
|
||||||
revision.move_type_de_champ(stable_id, compute_position(row, tdc.revision_type_de_champ))
|
|
||||||
|
|
||||||
tdc.update!(
|
tdc.update!(
|
||||||
libelle: row["new_libelle"].strip,
|
libelle: row["new_libelle"].strip,
|
||||||
|
@ -38,17 +37,5 @@ module Maintenance
|
||||||
mandatory: row["new_required"] == "true"
|
mandatory: row["new_required"] == "true"
|
||||||
)
|
)
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
|
@ -21,9 +21,9 @@ module Maintenance
|
||||||
demarche_id,id,new_libelle,new_description,new_required,new_position,delete_flag
|
demarche_id,id,new_libelle,new_description,new_required,new_position,delete_flag
|
||||||
#{procedure.id},#{find_by_stable_id(12).to_typed_id},[NEW] Number,[NEW] Number desc,true,0,
|
#{procedure.id},#{find_by_stable_id(12).to_typed_id},[NEW] Number,[NEW] Number desc,true,0,
|
||||||
#{procedure.id},#{find_by_stable_id(13).to_typed_id},Bloc,[NEW] bloc desc,,1,
|
#{procedure.id},#{find_by_stable_id(13).to_typed_id},Bloc,[NEW] bloc desc,,1,
|
||||||
#{procedure.id},#{find_by_stable_id(132).to_typed_id},[NEW] RepNum,,true,2,
|
#{procedure.id},#{find_by_stable_id(132).to_typed_id},[NEW] RepNum,,true,0,
|
||||||
#{procedure.id},#{find_by_stable_id(131).to_typed_id},[NEW] RepText,,,3,
|
#{procedure.id},#{find_by_stable_id(131).to_typed_id},[NEW] RepText,,,1,
|
||||||
#{procedure.id},#{find_by_stable_id(11).to_typed_id},[supp] Text,,,4,true
|
#{procedure.id},#{find_by_stable_id(11).to_typed_id},[supp] Text,,,2,true
|
||||||
CSV
|
CSV
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue