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
remove additional Hierarchy nesting
as-opf1e63c4d3964
diff --git a/app/models/exports/formatters/custom_field.rb b/app/models/exports/formatters/custom_field.rbindex 3c536bcafd7..f5e22a932cb 100644--- a/app/models/exports/formatters/custom_field.rb+++ b/app/models/exports/formatters/custom_field.rb@@ -59,7 +59,7 @@ module Exportswhen "text"object.typed_custom_value_for(custom_field)when "hierarchy"- ::Exports::Formatters::Hierarchy::HierarchyFormatter.new.format(object, custom_field)+ HierarchyFormatter.new.format(object, custom_field)elseobject.formatted_custom_value_for(custom_field)enddiff --git a/app/models/exports/formatters/hierarchy/hierarchy_formatter.rb b/app/models/exports/formatters/hierarchy_formatter.rbsimilarity index 63%rename from app/models/exports/formatters/hierarchy/hierarchy_formatter.rbrename to app/models/exports/formatters/hierarchy_formatter.rbindex 8fb68da56cd..e401b832a7b 100644--- a/app/models/exports/formatters/hierarchy/hierarchy_formatter.rb+++ b/app/models/exports/formatters/hierarchy_formatter.rb@@ -30,30 +30,28 @@module Exportsmodule Formatters- module Hierarchy- 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+ 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+ cvsend+ end- def format_hierarchy_item_for_export(item_value)- item = ::CustomField::Hierarchy::Item.find_by(id: item_value.to_s)- return "#{item_value} #{I18n.t(:label_not_found)}" if item.nil?+ def format_hierarchy_item_for_export(item_value)+ item = ::CustomField::Hierarchy::Item.find_by(id: item_value.to_s)+ return "#{item_value} #{I18n.t(:label_not_found)}" if item.nil?- item.ancestry_path- end+ item.ancestry_path+ end- def hierarchy_item_service- ::CustomFields::Hierarchy::HierarchicalItemService.new- end+ def hierarchy_item_service+ ::CustomFields::Hierarchy::HierarchicalItemService.newendendend