mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-24 15:54:00 +08:00
Merge pull request #4337 from aignatov-bio/ai-sci-7080-fix-step-element-deletetion
Fix step element delete callback [SCI-7080]
This commit is contained in:
commit
6334b481ef
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