From ef06ebaaa835d19847c87bcab7a88b0214600406 Mon Sep 17 00:00:00 2001 From: Gregor Schmidt Date: Wed, 26 Oct 2011 17:36:46 +0200 Subject: [PATCH] using newly added rebuild positions, when backlogs detects inconsistencies --- lib/redmine_backlogs/list.rb | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/lib/redmine_backlogs/list.rb b/lib/redmine_backlogs/list.rb index e7b3fd03f5..e9340b97c8 100644 --- a/lib/redmine_backlogs/list.rb +++ b/lib/redmine_backlogs/list.rb @@ -36,21 +36,8 @@ module RedmineBacklogs::List private def set_default_prev_positions_silently(prev) - stories = self.class.find(:all, :conditions => {:fixed_version_id => self.fixed_version_id, :tracker_id => self.class.trackers}) - - self.class.record_timestamps = false #temporarily turn off column updates - - highest_pos = stories.sort_by{|s| s.position ? s.position : 0}.collect(&:position).last - highest_pos = 0 if highest_pos.nil? - - stories.sort_by { |s| s.id }.each do |story| - next if story.in_list? || story.id > prev.id || self.id == story.id - story.insert_at(highest_pos += 1) - end - - self.class.record_timestamps = true #turning updates back on - - highest_pos + prev.version.rebuild_positions(prev.project) + prev.reload.position end end end