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