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
ensure order of multiple cf values when formatting a journal
ulferts4182de28e84a
diff --git a/lib/open_project/journal_formatter/custom_field.rb b/lib/open_project/journal_formatter/custom_field.rbindex 29cc7c3e06b..ece0b8ca95f 100644--- a/lib/open_project/journal_formatter/custom_field.rb+++ b/lib/open_project/journal_formatter/custom_field.rb@@ -49,8 +49,6 @@ class OpenProject::JournalFormatter::CustomField < ::JournalFormatter::Basedef get_old_and_new_value(custom_field, values)if custom_field.list?format_list custom_field, values- elsif custom_field.multi_value?- format_multi custom_field, valueselseformat_single custom_field, valuesend@@ -64,12 +62,6 @@ class OpenProject::JournalFormatter::CustomField < ::JournalFormatter::Base[old_option || old_value, new_option || new_value]end- def format_multi(custom_field, values)- old_value, new_value = values.map { |vs| formatted_values custom_field, vs }-- [old_value, new_value]- end-def format_single(custom_field, values)old_value = format_value(values.first, custom_field) if values.firstvalue = format_value(values.last, custom_field) if values.last@@ -78,27 +70,12 @@ class OpenProject::JournalFormatter::CustomField < ::JournalFormatter::Baseenddef find_list_value(custom_field, id)- if custom_field.multi_value?- custom_field_values(custom_field, id).join(", ")- else- custom_field.custom_options.find_by(id: id).try(:value)- end- end-- def formatted_values(custom_field, values)- String(values)- .split(",")- .map(&:strip)- .map { |value| format_value value, custom_field }- .join(", ")- .presence- end-- def custom_field_values(custom_field, id)custom_field.custom_options.where(id: id.split(","))+ .order(:position).pluck(:value).select(&:present?)+ .join(', ')endend