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