Defect #7335 » gantt-sort-trunk-r11856.diff
| lib/redmine/helpers/gantt.rb | ||
|---|---|---|
|
start_date + (end_date - start_date + 1) * (progress / 100.0)
|
||
|
end
|
||
|
# TODO: Sorts a collection of issues by start_date, due_date, id for gantt rendering
|
||
|
def self.sort_issues!(issues)
|
||
|
issues.sort! { |a, b| gantt_issue_compare(a, b) }
|
||
|
issues.sort! {|a, b| sort_issue_logic(a) <=> sort_issue_logic(b)}
|
||
|
end
|
||
|
# TODO: top level issues should be sorted by start date
|
||
|
def self.gantt_issue_compare(x, y)
|
||
|
if x.root_id == y.root_id
|
||
|
x.lft <=> y.lft
|
||
|
else
|
||
|
x.root_id <=> y.root_id
|
||
|
end
|
||
|
def self.sort_issue_logic(issue)
|
||
|
julian_date = Date.new()
|
||
|
ancesters_start_date = []
|
||
|
current_issue = issue
|
||
|
begin
|
||
|
ancesters_start_date.unshift([current_issue.start_date || julian_date, current_issue.id])
|
||
|
current_issue = current_issue.parent
|
||
|
end while (current_issue)
|
||
|
ancesters_start_date
|
||
|
end
|
||
|
def current_limit
|
||
| lib/redmine/helpers/gantt.rb | ||
|---|---|---|
|
return if abort?
|
||
|
end
|
||
|
versions = project_versions(project)
|
||
|
self.class.sort_versions!(versions)
|
||
|
versions.each do |version|
|
||
|
render_version(project, version, options)
|
||
|
end
|
||
| ... | ... | |
|
ancesters_start_date
|
||
|
end
|
||
|
def self.sort_versions!(versions)
|
||
|
versions.sort! {|a, b| sort_version_logic(a) <=> sort_version_logic(b)}
|
||
|
end
|
||
|
def self.sort_version_logic(version)
|
||
|
[(version.due_date || Date.new()), version.id]
|
||
|
end
|
||
|
def current_limit
|
||
|
if @max_rows
|
||
|
@max_rows - @number_of_rows
|
||