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
avoid deep nesting
ulferts247254495d05
diff --git a/app/services/base_type_service.rb b/app/services/base_type_service.rbindex 30112296ca9..36750ca1a46 100644--- a/app/services/base_type_service.rb+++ b/app/services/base_type_service.rb@@ -165,17 +165,12 @@ class BaseTypeService# for this type. If a custom field is not in a group, it is removed from the# custom_field_ids list.def set_active_custom_fields- active_cf_ids = []-- type.attribute_groups.each do |group|- group.members.each do |attribute|- if CustomField.custom_field_attribute? attribute- active_cf_ids << attribute.gsub(/^custom_field_/, "").to_i- end- end- end-- type.custom_field_ids = active_cf_ids.uniq+ type.custom_field_ids = type+ .attribute_groups+ .flat_map(&:members)+ .select { CustomField.custom_field_attribute? _1 }+ .map { _1.gsub(/^custom_field_/, "").to_i }+ .uniqenddef set_active_custom_fields_for_project_ids(project_ids)