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

more elegant code

as-op678820019db8
diff --git a/app/models/exports/formatters/hierarchy_formatter.rb b/app/models/exports/formatters/hierarchy_formatter.rb
index e401b832a7b..fec60692aaf 100644
--- a/app/models/exports/formatters/hierarchy_formatter.rb
+++ b/app/models/exports/formatters/hierarchy_formatter.rb
@@ -33,14 +33,7 @@ module Exports
class HierarchyFormatter
def format(object, custom_field)
cvs = object.custom_value_for(custom_field)
- case cvs
- when Array
- cvs.map { |item| format_hierarchy_item_for_export(item) }.join(", ")
- when CustomValue
- format_hierarchy_item_for_export(cvs)
- else
- cvs
- end
+ Array(cvs).map { |cv| format_hierarchy_item_for_export(cv) }.join(", ")
end
def format_hierarchy_item_for_export(item_value)