Commit d72be099 authored by jplang's avatar jplang

Fixes visibility checks for version.fixed_issues in Gantt (#27676).

Like the version page - the Gantt chart featured a "percent done" info
for each version, which wasn't properly limited to visible issues.

Patch by Gregor Schmidt.

git-svn-id: https://svn.redmine.org/redmine/trunk@17053 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent db1bf865
......@@ -301,9 +301,9 @@ module Redmine
def line_for_version(version, options)
# Skip versions that don't have a start_date
if version.is_a?(Version) && version.due_date && version.start_date
label = "#{h(version)} #{h(version.completed_percent.to_f.round)}%"
label = "#{h(version)} #{h(version.visible_fixed_issues.completed_percent.to_f.round)}%"
label = h("#{version.project} -") + label unless @project && @project == version.project
line(version.start_date, version.due_date, version.completed_percent, true, label, options, version)
line(version.start_date, version.due_date, version.visible_fixed_issues.completed_percent, true, label, options, version)
end
end
......@@ -679,9 +679,9 @@ module Redmine
html_class << (version.behind_schedule? ? 'version-behind-schedule' : '') << " "
html_class << (version.overdue? ? 'version-overdue' : '')
html_class << ' version-closed' unless version.open?
if version.start_date && version.due_date && version.completed_percent
if version.start_date && version.due_date && version.visible_fixed_issues.completed_percent
progress_date = calc_progress_date(version.start_date,
version.due_date, version.completed_percent)
version.due_date, version.visible_fixed_issues.completed_percent)
html_class << ' behind-start-date' if progress_date < self.date_from
html_class << ' over-end-date' if progress_date > self.date_to
end
......
......@@ -314,7 +314,7 @@ class Redmine::Helpers::GanttHelperTest < Redmine::HelperTest
version = Version.generate!(:name => 'Foo', :project => @project)
version.stubs(:start_date).returns(today - 7)
version.stubs(:due_date).returns(today + 7)
version.stubs(:completed_percent).returns(30)
version.stubs(:visible_fixed_issues => stub(:completed_percent => 30))
@output_buffer = @gantt.line_for_version(version, :format => :html)
assert_select "div.version.label", :text => /Foo/
assert_select "div.version.label", :text => /30%/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment