Closed WaQasRPL closed 8 months ago
Hi @WaQasRPL, I think the correct approach is to disable updates while you load in your data. If you have a look at the code, we run some simple update statements that move all records out of the way of your intended position. We don't check first.
Hope that helps :D
i have a excel importer where the position is defined in one of the column to be imported, each excel row is imported in its own sidekiq job, although the jobs are started in sequence but there is no guarantee they will also be executed in same sequence due to different checks and conditions. here is an example excel sample
then i am assigning the position to my list item as follows
parent.children.new(position: row[:position])
if the row jobs are executed in 1 , 2, 3 order then all good, but if for instance lets say 3 is executed before 2 so its sets the correct position which is 3 but upon completion of job 2 it increments the position 3, so i end up 1, 2 and 4 positions. it seems like a bug, i think it should only increment the current position if it exists.
i have tried different configuration like add_new_at, :top, :bottom but getting same result. it works only if i temporarily disable the acts_as_list by using no_update.