OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fixes Performance/Sum offenses
Klaus Zandersb853acafb0fc
diff --git a/lib/api/v3/notifications/property_factory.rb b/lib/api/v3/notifications/property_factory.rbindex ff2bd09cee8..73b212950f0 100644--- a/lib/api/v3/notifications/property_factory.rb+++ b/lib/api/v3/notifications/property_factory.rb@@ -64,7 +64,7 @@ module API::V3::Notifications# Returns the outward facing notification group attributesdef groups_for(values)group_values = values.except(*DATE_ALERT_REASONS)- date_alert_values = values.slice(*DATE_ALERT_REASONS).values.reduce(:+)+ date_alert_values = values.slice(*DATE_ALERT_REASONS).values.sumgroup_values["dateAlert"] = date_alert_values if date_alert_valuesgroup_valuesenddiff --git a/modules/costs/lib/costs/attributes_helper.rb b/modules/costs/lib/costs/attributes_helper.rbindex f31546abdce..39b0a8fe476 100644--- a/modules/costs/lib/costs/attributes_helper.rb+++ b/modules/costs/lib/costs/attributes_helper.rb@@ -76,12 +76,12 @@ module Costsdef material_costscost_entries_with_rate = cost_entries.select { |c| c.costs_visible_by?(@user) }- cost_entries_with_rate.blank? ? nil : cost_entries_with_rate.map(&:real_costs).sum+ cost_entries_with_rate.blank? ? nil : cost_entries_with_rate.sum(&:real_costs)enddef labor_coststime_entries_with_rate = time_entries.select { |c| c.costs_visible_by?(@user) }- time_entries_with_rate.blank? ? nil : time_entries_with_rate.map(&:real_costs).sum+ time_entries_with_rate.blank? ? nil : time_entries_with_rate.sum(&:real_costs)enddef user_allowed_to?(*privileges)diff --git a/modules/reporting/spec/models/cost_query/result_spec.rb b/modules/reporting/spec/models/cost_query/result_spec.rbindex 537eeaa7fdf..11d6e97ce72 100644--- a/modules/reporting/spec/models/cost_query/result_spec.rb+++ b/modules/reporting/spec/models/cost_query/result_spec.rb@@ -109,11 +109,11 @@ RSpec.describe CostQuery, reporting_query_helper: true doendit "computes units correctly" do- expect(query.result.units).to eq(Entry.all.map(&:units).sum)+ expect(query.result.units).to eq(Entry.all.sum(&:units))endit "computes real_costs correctly" do- expect(query.result.real_costs).to eq(Entry.all.map { |e| e.overridden_costs || e.costs }.sum)+ expect(query.result.real_costs).to eq(Entry.all.sum { |e| e.overridden_costs || e.costs })endit "computes count for DirectResults" do