甘特图一些修改

This commit is contained in:
huang 2016-11-07 17:18:00 +08:00
parent a7a25a4a2a
commit ce3bfee27c
1 changed files with 5 additions and 4 deletions

View File

@ -137,7 +137,7 @@ module Redmine
def issues def issues
@issues ||= @query.issues( @issues ||= @query.issues(
:include => [:assigned_to, :tracker, :priority, :category, :fixed_version], :include => [:assigned_to, :tracker, :priority, :category, :fixed_version],
:order => "#{Issue.table_name}.updated_on DESC", :order => "#{Project.table_name}.lft DESC, #{Issue.table_name}.updated_on DESC",
:limit => @max_rows :limit => @max_rows
) )
end end
@ -677,15 +677,16 @@ module Redmine
# Sorts a collection of issues by start_date, due_date, id for gantt rendering # Sorts a collection of issues by start_date, due_date, id for gantt rendering
def sort_issues!(issues) def sort_issues!(issues)
issues.sort! { |a, b| gantt_issue_compare(a, b) } # issues.sort! { |a, b| gantt_issue_compare(a, b) }
issues
end end
# TODO: top level issues should be sorted by start date # TODO: top level issues should be sorted by start date
def gantt_issue_compare(x, y) def gantt_issue_compare(x, y)
if x.root_id == y.root_id if x.root_id == y.root_id
x.lft <=> y.lft x.updated_on <=> y.updated_on
else else
x.root_id <=> y.root_id x.updated_on <=> y.updated_on
end end
end end