From daef6a8037ab66e1b2716ef42a197fc20228b237 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 7 Jan 2015 20:26:21 +0000 Subject: [PATCH] Insert children issues to respect same order as ids. git-svn-id: http://svn.redmine.org/redmine/trunk@13842 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/nested_set/issue_nested_set.rb | 2 +- test/unit/issue_nested_set_test.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/redmine/nested_set/issue_nested_set.rb b/lib/redmine/nested_set/issue_nested_set.rb index dac340ba3..5a6af9440 100644 --- a/lib/redmine/nested_set/issue_nested_set.rb +++ b/lib/redmine/nested_set/issue_nested_set.rb @@ -36,7 +36,7 @@ module Redmine 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) + scope_for_max_rgt = scope_for_max_rgt.where("id < ?", id) end max_rgt = scope_for_max_rgt.maximum(:rgt) if max_rgt diff --git a/test/unit/issue_nested_set_test.rb b/test/unit/issue_nested_set_test.rb index d31acdee2..86c859435 100644 --- a/test/unit/issue_nested_set_test.rb +++ b/test/unit/issue_nested_set_test.rb @@ -77,8 +77,8 @@ class IssueNestedSetTest < ActiveSupport::TestCase parent1.reload parent2.reload assert_equal [parent1.id, lft, lft + 5], [parent1.root_id, parent1.lft, parent1.rgt] - assert_equal [parent1.id, lft + 3, lft + 4], [parent2.root_id, parent2.lft, parent2.rgt] - assert_equal [parent1.id, lft + 1, lft + 2], [child.root_id, child.lft, child.rgt] + assert_equal [parent1.id, lft + 1, lft + 2], [parent2.root_id, parent2.lft, parent2.rgt] + assert_equal [parent1.id, lft + 3, lft + 4], [child.root_id, child.lft, child.rgt] end def test_move_a_child_to_root -- 2.39.5