Actions
Defect #6968
closedSorting of issues in Gantt
Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Gantt
Target version:
-
Start date:
2010-11-24
Due date:
% Done:
0%
Estimated time:
Resolution:
Duplicate
Affected version:
Description
I've got a problem with the sorting of issues in the Gantt. Some issues are not affected to their parent but to another parent.
I don't think it's possible to sort the list of issues correctly with a comparer like it's done in gantt.rb, so i've modified the gantt.rb in lib/redmine/helpers. I have added a private function :
def gantt_issue_sort(all)
def get_sorted_childs(id, issues)
childs = issues.select {| i|
i.parent_id == id
}.sort {|x, y|
gantt_start_compare(x, y)
}
childs
end
def sort(id, issues, result)
childs = get_sorted_childs(id, issues)
childs.each do |c|
result << c
sort(c.id, issues, result)
end
end
result = []
issues = all.select {|i| i.is_a?(Issue)}
others = all.select {|i| not i.is_a?(Issue)}
sort(nil, issues, result)
result += others
result
end
and i have modified the def events=(e), just before the reject i have added :
@events = gantt_issue_sort(@events)
It's just a quick and dirty fix by somebody who has no experience in ruby programming, but i thought it might help to send you my code.
Related issues
Actions