Skip to content

Commit

Permalink
feat(update_draft_revision_type_de_champs_task): force to use real po…
Browse files Browse the repository at this point in the history
…sition otherwise have to process parent_coordinates...
  • Loading branch information
Martin committed Jan 18, 2024
1 parent 88bbd6f commit e88d29f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,13 @@ def process(row)
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,
description: row["new_description"]&.strip.to_s, # we want empty string
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
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ module Maintenance
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(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(131).to_typed_id},[NEW] RepText,,,3,
#{procedure.id},#{find_by_stable_id(11).to_typed_id},[supp] Text,,,4,true
#{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,,,1,
#{procedure.id},#{find_by_stable_id(11).to_typed_id},[supp] Text,,,2,true
CSV
end

Expand Down

0 comments on commit e88d29f

Please sign in to comment.