diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-11-21 13:54:26 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-11-21 13:54:26 +0000 |
commit | 77c6188ec27288470d5270213aa0aef3be0eb655 (patch) | |
tree | 048fb2bae70520946db1d7e2b096a42a92d271bc /lib | |
parent | 1158716f46a8a1559ebc5d9ec0f8310c10defc5f (diff) | |
download | redmine-77c6188ec27288470d5270213aa0aef3be0eb655.tar.gz redmine-77c6188ec27288470d5270213aa0aef3be0eb655.zip |
Fixed: gantt displays issues by date of creation.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4421 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/helpers/gantt.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index ea7f1417a..ac8f80d0f 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -178,6 +178,7 @@ module Redmine # Second, Issues without a version issues = project.issues.for_gantt.without_version.with_query(@query) + sort_issues!(issues) if issues issue_rendering = render_issues(issues, options) output << issue_rendering if options[:format] == :html @@ -237,6 +238,7 @@ module Redmine issues = version.fixed_issues.for_gantt.with_query(@query) if issues + sort_issues!(issues) # Indent issues options[:indent] += options[:indent_increment] output << render_issues(issues, options) @@ -952,6 +954,17 @@ module Redmine private + # Sorts a collection of issues by start_date, due_date, id for gantt rendering + def sort_issues!(issues) + issues.sort! do |a, b| + cmp = 0 + cmp = (a.start_date <=> b.start_date) if a.start_date? && b.start_date? + cmp = (a.due_date <=> b.due_date) if cmp == 0 && a.due_date? && b.due_date? + cmp = (a.id <=> b.id) if cmp == 0 + cmp + end + end + # Renders both the subjects and lines of the Gantt chart for the # PDF format def pdf_subjects_and_lines(pdf, options = {}) |