From: Go MAEDA Date: Sun, 27 Oct 2024 06:30:10 +0000 (+0000) Subject: Fix RuboCop Style/MultilineIfModifier in ReportsHelper by using safe navigation opera... X-Git-Tag: 6.0.0~42 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=48a7fd50cb491e590479e9a4455c0fc5a3fe69ac;p=redmine.git Fix RuboCop Style/MultilineIfModifier in ReportsHelper by using safe navigation operator (#39887). git-svn-id: https://svn.redmine.org/redmine/trunk@23166 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 09f5388f0..0f316a54b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -950,7 +950,6 @@ Style/MultilineIfModifier: - 'app/helpers/attachments_helper.rb' - 'app/helpers/custom_fields_helper.rb' - 'app/helpers/projects_helper.rb' - - 'app/helpers/reports_helper.rb' - 'app/helpers/repositories_helper.rb' - 'app/helpers/search_helper.rb' - 'app/models/issue_query.rb' diff --git a/app/helpers/reports_helper.rb b/app/helpers/reports_helper.rb index d49b43f4e..6390ecbdb 100644 --- a/app/helpers/reports_helper.rb +++ b/app/helpers/reports_helper.rb @@ -20,17 +20,17 @@ module ReportsHelper def aggregate(data, criteria) a = 0 - data.each do |row| + data&.each do |row| match = 1 - criteria.each do |k, v| + 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? + end a = a + row["total"].to_i if match == 1 - end unless data.nil? + end a end