Actions
Defect #41977
opennested_set move node error
Status:
New
Priority:
Normal
Assignee:
-
Category:
Issues
Target version:
-
Resolution:
Affected version:
Description
1node6 ------------------------> 1node6
/ \ \
/ \ \
2node3 4node5 2node5
.
.
3node5
in nest set when a node move to in the same root, then parent.lft need reload in the method target_lft
def target_lft
scope_for_max_rgt = self.class.where(:root_id => root_id).where(:parent_id => parent_id)
if id
scope_for_max_rgt = scope_for_max_rgt.where(id: ...id)
end
max_rgt = scope_for_max_rgt.maximum(:rgt)
if max_rgt
max_rgt + 1
elsif parent
# parent need reload lft, rgt
parent.send :reload_nested_set_values
parent.lft + 1
else
1
end
end
Updated by yingchao wu about 1 year ago
1node6 ------------------------> 1node6
/ \ \
/ \ \
2node3 4node5 2node5
.
.
3node4
Updated by Go MAEDA about 1 year ago
I still haven't been able to reproduce this issue. I attempted to move an issue but couldn't trigger any inconsistencies in the `lft` and `rgt` values. Could you please provide a step-by-step reproduction process?
Actions