Code cleanup.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11496 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
5bf647f290
commit
f544dd682b
|
@ -1170,7 +1170,7 @@ class Issue < ActiveRecord::Base
|
||||||
# issue was just created
|
# issue was just created
|
||||||
self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id)
|
self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id)
|
||||||
set_default_left_and_right
|
set_default_left_and_right
|
||||||
Issue.update_all("root_id = #{root_id}, lft = #{lft}, rgt = #{rgt}", ["id = ?", id])
|
Issue.update_all(["root_id = ?, lft = ?, rgt = ?", root_id, lft, rgt], ["id = ?", id])
|
||||||
if @parent_issue
|
if @parent_issue
|
||||||
move_to_child_of(@parent_issue)
|
move_to_child_of(@parent_issue)
|
||||||
end
|
end
|
||||||
|
@ -1189,7 +1189,7 @@ class Issue < ActiveRecord::Base
|
||||||
self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id )
|
self.root_id = (@parent_issue.nil? ? id : @parent_issue.root_id )
|
||||||
target_maxright = nested_set_scope.maximum(right_column_name) || 0
|
target_maxright = nested_set_scope.maximum(right_column_name) || 0
|
||||||
offset = target_maxright + 1 - lft
|
offset = target_maxright + 1 - lft
|
||||||
Issue.update_all("root_id = #{root_id}, lft = lft + #{offset}, rgt = rgt + #{offset}",
|
Issue.update_all(["root_id = ?, lft = lft + ?, rgt = rgt + ?", root_id, offset, offset],
|
||||||
["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt])
|
["root_id = ? AND lft >= ? AND rgt <= ? ", old_root_id, lft, rgt])
|
||||||
self[left_column_name] = lft + offset
|
self[left_column_name] = lft + offset
|
||||||
self[right_column_name] = rgt + offset
|
self[right_column_name] = rgt + offset
|
||||||
|
|
Loading…
Reference in New Issue