Skip to content

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

Fixes Performance/FlatMap offenses

Klaus Zanders00a1f0fd55a5
diff --git a/db/migrate/20211005080304_tzinfo_time_zones.rb b/db/migrate/20211005080304_tzinfo_time_zones.rb
index a928cb630b3..d534f1b1593 100644
--- a/db/migrate/20211005080304_tzinfo_time_zones.rb
+++ b/db/migrate/20211005080304_tzinfo_time_zones.rb
@@ -30,14 +30,13 @@ class TzinfoTimeZones < ActiveRecord::Migration[6.1]
def up
zone_mappings = ActiveSupport::TimeZone
.all
- .map do |tz|
+ .flat_map do |tz|
[
[tz.name, tz.tzinfo.canonical_zone.name],
# Some entries seem to already be in that format so we leave them unchanged
[tz.tzinfo.canonical_zone.name, tz.tzinfo.canonical_zone.name]
]
end
- .flatten(1)
migrate_user_time_zone(zone_mappings)
migrate_default_time_zone(zone_mappings)