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

[#66093] Show calculated value errors in project list

Tobias Dillmann99f2a7de361e
diff --git a/app/components/projects/row_component.rb b/app/components/projects/row_component.rb
index e95ad68eb36..bf12dbb470f 100644
--- a/app/components/projects/row_component.rb
+++ b/app/components/projects/row_component.rb
@@ -93,6 +93,15 @@ module Projects
)
elsif custom_value.is_a?(Array)
safe_join(Array(custom_value).compact_blank, ", ")
+ elsif cf.calculated_value?
+ errors = cf.calculated_value_errors.where(project:)
+
+ if errors.any?
+ # TODO: format like an error
+ errors.map(&:error_message).join(" ")
+ else
+ custom_value
+ end
else
custom_value
end
diff --git a/app/models/custom_field.rb b/app/models/custom_field.rb
index 6375a94152c..932c92e8c5e 100644
--- a/app/models/custom_field.rb
+++ b/app/models/custom_field.rb
@@ -325,6 +325,8 @@ class CustomField < ApplicationRecord
field_format == "calculated_value"
end
+ def calculated_value? = field_format_calculated_value?
+
def hierarchical_list?
field_format_hierarchy? || field_format_scored_list?
end