Use .distinct instead of .uniq.

git-svn-id: http://svn.redmine.org/redmine/trunk@15654 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2016-07-14 07:15:13 +00:00
parent e58e676b7c
commit d2f7e31951
14 changed files with 20 additions and 20 deletions

View File

@@ -176,7 +176,7 @@ module Redmine
reorder(:id).lock.ids
update_all(:root_id => nil, :lft => nil, :rgt => nil)
where(:parent_id => nil).update_all(["root_id = id, lft = ?, rgt = ?", 1, 2])
roots_with_children = joins("JOIN #{table_name} parent ON parent.id = #{table_name}.parent_id AND parent.id = parent.root_id").uniq.pluck("parent.id")
roots_with_children = joins("JOIN #{table_name} parent ON parent.id = #{table_name}.parent_id AND parent.id = parent.root_id").distinct.pluck("parent.id")
roots_with_children.each do |root_id|
rebuild_nodes(root_id)
end