feat(routing): server side: prevent tdc deletion if used for routing
This commit is contained in:
parent
3f55fddcef
commit
c1f67499aa
3 changed files with 59 additions and 36 deletions
|
@ -225,6 +225,16 @@ class ProcedureRevision < ApplicationRecord
|
|||
types_de_champ_public.any?(&:carte?)
|
||||
end
|
||||
|
||||
def coordinate_and_tdc(stable_id)
|
||||
return [nil, nil] if stable_id.blank?
|
||||
|
||||
coordinate = revision_types_de_champ
|
||||
.joins(:type_de_champ)
|
||||
.find_by(type_de_champ: { stable_id: stable_id })
|
||||
|
||||
[coordinate, coordinate&.type_de_champ]
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def compute_estimated_fill_duration
|
||||
|
@ -245,16 +255,6 @@ class ProcedureRevision < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def coordinate_and_tdc(stable_id)
|
||||
return [nil, nil] if stable_id.blank?
|
||||
|
||||
coordinate = revision_types_de_champ
|
||||
.joins(:type_de_champ)
|
||||
.find_by(type_de_champ: { stable_id: stable_id })
|
||||
|
||||
[coordinate, coordinate&.type_de_champ]
|
||||
end
|
||||
|
||||
def renumber(siblings)
|
||||
siblings.to_a.compact.each.with_index do |sibling, position|
|
||||
sibling.update_column(:position, position)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue