Project

General

Profile

Defect #7352 » gantt.rb.patch

Etienne Massip, 2011-01-18 11:48

View differences:

lib/redmine/helpers/gantt.rb (working copy)
98 98
        common_params.merge({:year => (date_from >> months).year, :month => (date_from >> months).month, :zoom => zoom, :months => months })
99 99
      end
100 100

  
101
            ### Extracted from the HTML view/helpers
101
      # Returns the list of projects to render
102
      def project_list
103
        projects = @project ? [@project] : Project.roots.visible.has_module('issue_tracking')
104
        @query && @query.has_filter?('project_id') ? projects & Project.find(@query.values_for('project_id')) : projects
105
      end
106

  
107
      ### Extracted from the HTML view/helpers
102 108
      # Returns the number of rows that will be rendered on the Gantt chart
103 109
      def number_of_rows
104 110
        return @number_of_rows if @number_of_rows
105 111
        
106
        rows = if @project
107
          number_of_rows_on_project(@project)
108
        else
109
          Project.roots.visible.has_module('issue_tracking').inject(0) do |total, project|
110
            total += number_of_rows_on_project(project)
111
          end
112
        rows = project_list().each do |total, project|
113
          total += number_of_rows_on_project(project)
112 114
        end
113 115
        
114 116
        rows > @max_rows ? @max_rows : rows
......
161 163
        @subjects = '' unless options[:only] == :lines
162 164
        @lines = '' unless options[:only] == :subjects
163 165
        @number_of_rows = 0
164
        
165
        if @project
166
          render_project(@project, options)
167
        else
168
          Project.roots.visible.has_module('issue_tracking').each do |project|
169
            render_project(project, options)
170
            break if abort?
171
          end
166

  
167
        project_list().each do |project|
168
          render_project(project, options)
169
          break if abort?
172 170
        end
173
        
171

  
174 172
        @subjects_rendered = true unless options[:only] == :lines
175 173
        @lines_rendered = true unless options[:only] == :subjects
176 174
        
......
373 371
        output
374 372
      end
375 373

  
376
      def line_for_issue(issue, options)
374
      def line_for_issue(issue, options)  
377 375
        # Skip issues that don't have a due_before (due_date or version's due_date)
378 376
        if issue.is_a?(Issue) && issue.due_before
379 377
          coords = coordinates(issue.start_date, issue.due_before, issue.done_ratio, options[:zoom])
(1-1/2)