refactor(spec): stop using procedure type de champs traits as :with_datetime
, :with_xxx
in favor of :types_de_champ_public
which keeps position in check
This commit is contained in:
parent
15e0ed8480
commit
2952987ad8
35 changed files with 167 additions and 293 deletions
|
@ -264,12 +264,11 @@ class ProcedureRevision < ApplicationRecord
|
|||
end
|
||||
|
||||
def next_position_for(siblings:, after_coordinate: nil)
|
||||
if siblings.to_a.empty? # first element of the list, starts at 0
|
||||
# either we are at the beginning of the list or after another item
|
||||
if after_coordinate.nil? # first element of the list, starts at 0
|
||||
0
|
||||
elsif after_coordinate # middle of the list, between two items
|
||||
else # after another item
|
||||
after_coordinate.position + 1
|
||||
else # last element of the list, end with last position + 1
|
||||
siblings.to_a.last.position + 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue