This commit is contained in:
simon lehericey 2022-09-26 21:21:55 +02:00
parent f98d1463a6
commit 43f926a1de
11 changed files with 14 additions and 14 deletions

View file

@ -317,7 +317,7 @@ class ProcedureRevision < ApplicationRecord
changed = kept
.map { |sid| [sid, from_h[sid], to_h[sid]] }
.flat_map do |sid, from, to|
compare_type_de_champ(from.type_de_champ, to.type_de_champ)
compare_type_de_champ(from.type_de_champ, to.type_de_champ, from_coordinates, to_coordinates)
.each { |h| h[:_position] = to_sids.index(sid) }
end
@ -327,7 +327,7 @@ class ProcedureRevision < ApplicationRecord
end
end
def compare_type_de_champ(from_type_de_champ, to_type_de_champ)
def compare_type_de_champ(from_type_de_champ, to_type_de_champ, from_coordinates, to_coordinates)
changes = []
if from_type_de_champ.type_champ != to_type_de_champ.type_champ
changes << {
@ -385,8 +385,8 @@ class ProcedureRevision < ApplicationRecord
attribute: :condition,
label: from_type_de_champ.libelle,
private: from_type_de_champ.private?,
from: from_type_de_champ.condition&.to_s,
to: to_type_de_champ.condition&.to_s,
from: from_type_de_champ.condition&.to_s(from_coordinates.map(&:type_de_champ)),
to: to_type_de_champ.condition&.to_s(to_coordinates.map(&:type_de_champ)),
stable_id: from_type_de_champ.stable_id
}
end