Project

General

Profile

Defect #7335 » sort_issues_from_start_date.diff

Felipe Ribeiro, 2011-12-05 20:03

View differences:

lib/redmine/helpers/gantt.rb (working copy)
if x.root_id == y.root_id
x.lft <=> y.lft
else
x.root_id <=> y.root_id
if x.start_date != nil and y.start_date != nil
x.start_date <=> y.start_date
elsif x.start_date != nil
-1
elsif y.start_date != nil
1
else
x.root_id <=> y.root_id
end
end
end
app/models/issue.rb (working copy)
# update former parent
recalculate_attributes_for(former_parent_id) if former_parent_id
end
if self.parent != nil and self.start_date
lesser_sibling_found = false
last_visited = nil
self.parent.children.reverse.each do |sibling|
if (sibling != self and sibling.start_date and sibling.start_date < self.start_date)
if last_visited != self
move_to_right_of sibling
end
lesser_sibling_found = true
break
end
last_visited = sibling
end
if self.parent.children[0] != self and not lesser_sibling_found
move_to_left_of(self.parent.children[0])
end
end
remove_instance_variable(:@parent_issue) if instance_variable_defined?(:@parent_issue)
end
(1-1/13)