summaryrefslogtreecommitdiffstats
path: root/app/models/version.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2025-05-06 06:45:36 +0000
committerGo MAEDA <maeda@farend.jp>2025-05-06 06:45:36 +0000
commit7e4acb6b23d3a76bac3d85e8e416855a07ac48b1 (patch)
tree47ffe06f2eda22ad5e27a16892bae0269a1df43d /app/models/version.rb
parentc227b006e15859b579c436094095c5e188cd3c06 (diff)
downloadredmine-master.tar.gz
redmine-master.zip
Optimize `Version::FixedIssuesExtension#issues_progress` by avoiding repeated `Issue#closed?` calls (#42673).HEADmaster
Since the issues are already filtered by open or closed status using the `open` argument through the `self.open(open)` scope, the call to expensive method `Issue#closed?` can be safely replaced with a check of the `open` argument. Patch by Go MAEDA (user:maeda). git-svn-id: https://svn.redmine.org/redmine/trunk@23747 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/version.rb')
-rw-r--r--app/models/version.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/version.rb b/app/models/version.rb
index 707ed59dc..3ca4f2bff 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -106,7 +106,7 @@ module FixedIssuesExtension
done = self.open(open).sum do |c|
estimated = c.total_estimated_hours.to_f
estimated = estimated_average unless estimated > 0.0
- ratio = c.closed? ? 100 : (c.done_ratio || 0)
+ ratio = open ? (c.done_ratio || 0) : 100
estimated * ratio
end
progress = done / (estimated_average * issues_count)