From 00e52fb9de6437ad31d50a69de335661a86ea2df Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sun, 11 Oct 2020 12:57:16 +0000 Subject: [PATCH] shorten long line of ReportsHelper git-svn-id: http://svn.redmine.org/redmine/trunk@20139 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/reports_helper.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index 5e8276455..9d01fe455 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -21,13 +21,17 @@ module ReportsHelper def aggregate(data, criteria) a = 0 - data.each { |row| + data.each do |row| match = 1 - criteria.each { |k, v| - match = 0 unless (row[k].to_s == v.to_s) || (k == 'closed' && (v == 0 ? ['f', false] : ['t', true]).include?(row[k])) - } unless criteria.nil? + criteria.each do |k, v| + unless (row[k].to_s == v.to_s) || + (k == 'closed' && + (v == 0 ? ['f', false] : ['t', true]).include?(row[k])) + match = 0 + end + end unless criteria.nil? a = a + row["total"].to_i if match == 1 - } unless data.nil? + end unless data.nil? a end -- 2.39.5