mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 02:04:33 +08:00
Fix step element delete callback [SCI-7080]
This commit is contained in:
parent
897a8f71ec
commit
5cd887831c
1 changed files with 4 additions and 1 deletions
|
@ -23,7 +23,10 @@ class StepOrderableElement < ApplicationRecord
|
|||
def decrement_following_elements_positions
|
||||
step.with_lock do
|
||||
yield
|
||||
step.step_orderable_elements.where('position > ?', position).find_each do |step_orderable_element|
|
||||
step.step_orderable_elements
|
||||
.where('position > ?', position)
|
||||
.order(position: :asc).each do |step_orderable_element|
|
||||
# find_each ignore any ordering
|
||||
step_orderable_element.position -= 1
|
||||
step_orderable_element.save!
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue