From 0b6f4c6811a4a4e823674e3bb8b970ee46a9194b Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Tue, 17 Jan 2023 01:38:27 +0000 Subject: Ruby 2.7: Fix RuboCop offense Performance/MapCompact (#38134). git-svn-id: https://svn.redmine.org/redmine/trunk@22055 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/helpers/gantt.rb | 2 +- lib/redmine/helpers/time_report.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/redmine/helpers') diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb index 448d3190e..3614829db 100644 --- a/lib/redmine/helpers/gantt.rb +++ b/lib/redmine/helpers/gantt.rb @@ -198,7 +198,7 @@ module Redmine # Returns the distinct versions of the issues that belong to +project+ def project_versions(project) - project_issues(project).collect(&:fixed_version).compact.uniq + project_issues(project).filter_map(&:fixed_version).uniq end # Returns the issues that belong to +project+ and are assigned to +version+ diff --git a/lib/redmine/helpers/time_report.rb b/lib/redmine/helpers/time_report.rb index 79ac6b020..c6e98ebf1 100644 --- a/lib/redmine/helpers/time_report.rb +++ b/lib/redmine/helpers/time_report.rb @@ -49,7 +49,7 @@ module Redmine @scope.includes(:activity). reorder(nil). group(@criteria.collect{|criteria| @available_criteria[criteria][:sql]} + time_columns). - joins(@criteria.collect{|criteria| @available_criteria[criteria][:joins]}.compact). + joins(@criteria.filter_map{|criteria| @available_criteria[criteria][:joins]}). sum(:hours).each do |hash, hours| h = {'hours' => hours} (@criteria + time_columns).each_with_index do |name, i| -- cgit v1.2.3