Project

General

Profile

Patch #27676 » 0004-Fixes-visibility-checks-for-version.fixed_issues-in-.patch

Jan from Planio www.plan.io, 2017-11-29 17:24

View differences:

lib/redmine/helpers/gantt.rb
301 301
      def line_for_version(version, options)
302 302
        # Skip versions that don't have a start_date
303 303
        if version.is_a?(Version) && version.due_date && version.start_date
304
          label = "#{h(version)} #{h(version.completed_percent.to_f.round)}%"
304
          label = "#{h(version)} #{h(version.visible_fixed_issues.completed_percent.to_f.round)}%"
305 305
          label = h("#{version.project} -") + label unless @project && @project == version.project
306
          line(version.start_date, version.due_date,  version.completed_percent, true, label, options, version)
306
          line(version.start_date, version.due_date,  version.visible_fixed_issues.completed_percent, true, label, options, version)
307 307
        end
308 308
      end
309 309

  
......
678 678
          html_class << (version.behind_schedule? ? 'version-behind-schedule' : '') << " "
679 679
          html_class << (version.overdue? ? 'version-overdue' : '')
680 680
          html_class << ' version-closed' unless version.open?
681
          if version.start_date && version.due_date && version.completed_percent
681
          if version.start_date && version.due_date && version.visible_fixed_issues.completed_percent
682 682
            progress_date = calc_progress_date(version.start_date,
683
                                               version.due_date, version.completed_percent)
683
                                               version.due_date, version.visible_fixed_issues.completed_percent)
684 684
            html_class << ' behind-start-date' if progress_date < self.date_from
685 685
            html_class << ' over-end-date' if progress_date > self.date_to
686 686
          end
test/unit/lib/redmine/helpers/gantt_test.rb
314 314
    version = Version.generate!(:name => 'Foo', :project => @project)
315 315
    version.stubs(:start_date).returns(today - 7)
316 316
    version.stubs(:due_date).returns(today + 7)
317
    version.stubs(:completed_percent).returns(30)
317
    version.stubs(:visible_fixed_issues => stub(:completed_percent => 30))
318 318
    @output_buffer = @gantt.line_for_version(version, :format => :html)
319 319
    assert_select "div.version.label", :text => /Foo/
320 320
    assert_select "div.version.label", :text => /30%/
(1-1/4)