From 7e4acb6b23d3a76bac3d85e8e416855a07ac48b1 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 6 May 2025 06:45:36 +0000 Subject: [PATCH] Optimize `Version::FixedIssuesExtension#issues_progress` by avoiding repeated `Issue#closed?` calls (#42673). 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 --- app/models/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)