##// END OF EJS Templates
Gantt: Avoid unnecessary queries before rendering....
Jean-Philippe Lang -
r4362:4715a37937cb
parent child
Show More
@@ -59,11 +59,13 end
59 59
60 60 # Width of the entire chart
61 61 g_width = (@gantt.date_to - @gantt.date_from + 1)*zoom
62 # Collect the number of issues on Versions
62
63 @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width)
64
63 65 g_height = [(20 * (@gantt.number_of_rows + 6))+150, 206].max
64 66 t_height = g_height + headers_height
65 67
66 @gantt.render(:top => headers_height + 8, :zoom => zoom, :g_width => g_width)
68
67 69 %>
68 70 <table width="100%" style="border:0; border-collapse: collapse;">
69 71 <tr>
@@ -70,6 +70,7 module Redmine
70 70
71 71 @subjects = ''
72 72 @lines = ''
73 @number_of_rows = nil
73 74 end
74 75
75 76 def common_params
@@ -91,6 +92,8 module Redmine
91 92 ### Extracted from the HTML view/helpers
92 93 # Returns the number of rows that will be rendered on the Gantt chart
93 94 def number_of_rows
95 return @number_of_rows if @number_of_rows
96
94 97 if @project
95 98 return number_of_rows_on_project(@project)
96 99 else
@@ -146,6 +149,7 module Redmine
146 149
147 150 @subjects = '' unless options[:only] == :lines
148 151 @lines = '' unless options[:only] == :subjects
152 @number_of_rows = 0
149 153
150 154 if @project
151 155 render_project(@project, options)
@@ -171,6 +175,7 module Redmine
171 175
172 176 options[:top] += options[:top_increment]
173 177 options[:indent] += options[:indent_increment]
178 @number_of_rows += 1
174 179
175 180 # Second, Issues without a version
176 181 issues = project.issues.for_gantt.without_version.with_query(@query)
@@ -199,6 +204,7 module Redmine
199 204 line_for_issue(i, options) unless options[:only] == :subjects
200 205
201 206 options[:top] += options[:top_increment]
207 @number_of_rows += 1
202 208 end
203 209 end
204 210
@@ -208,7 +214,8 module Redmine
208 214 line_for_version(version, options) unless options[:only] == :subjects
209 215
210 216 options[:top] += options[:top_increment]
211
217 @number_of_rows += 1
218
212 219 # Remove the project requirement for Versions because it will
213 220 # restrict issues to only be on the current project. This
214 221 # ends up missing issues which are assigned to shared versions.
General Comments 0
You need to be logged in to leave comments. Login now