diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-07 19:29:47 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-12-07 19:29:47 +0000 |
commit | 4715a37937cb30192df17a7db18c5f31f24463b0 (patch) | |
tree | e9ceee4d8106aa9d68d9ba31faab0ab24caaf08c /lib | |
parent | 318bd10c7f4dcbbb3dff472380929f70be53c863 (diff) | |
download | redmine-4715a37937cb30192df17a7db18c5f31f24463b0.tar.gz redmine-4715a37937cb30192df17a7db18c5f31f24463b0.zip |
Gantt: Avoid unnecessary queries before rendering.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4476 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r-- | lib/redmine/helpers/gantt.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index b64347343..274b4442f 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -70,6 +70,7 @@ module Redmine @subjects = '' @lines = '' + @number_of_rows = nil end def common_params @@ -91,6 +92,8 @@ module Redmine ### Extracted from the HTML view/helpers # Returns the number of rows that will be rendered on the Gantt chart def number_of_rows + return @number_of_rows if @number_of_rows + if @project return number_of_rows_on_project(@project) else @@ -146,6 +149,7 @@ module Redmine @subjects = '' unless options[:only] == :lines @lines = '' unless options[:only] == :subjects + @number_of_rows = 0 if @project render_project(@project, options) @@ -171,6 +175,7 @@ module Redmine options[:top] += options[:top_increment] options[:indent] += options[:indent_increment] + @number_of_rows += 1 # Second, Issues without a version issues = project.issues.for_gantt.without_version.with_query(@query) @@ -199,6 +204,7 @@ module Redmine line_for_issue(i, options) unless options[:only] == :subjects options[:top] += options[:top_increment] + @number_of_rows += 1 end end @@ -208,7 +214,8 @@ module Redmine line_for_version(version, options) unless options[:only] == :subjects options[:top] += options[:top_increment] - + @number_of_rows += 1 + # Remove the project requirement for Versions because it will # restrict issues to only be on the current project. This # ends up missing issues which are assigned to shared versions. |