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

move deciding which custom field can be grouped by to order statements

Ivan Kuchinb886078e28f8
diff --git a/app/models/custom_field/order_statements.rb b/app/models/custom_field/order_statements.rb
index 435852ecb15..ef4da8fe948 100644
--- a/app/models/custom_field/order_statements.rb
+++ b/app/models/custom_field/order_statements.rb
@@ -68,6 +68,8 @@ module CustomField::OrderStatements
# which differ for multi-value select fields,
# because in this case we do want the primary CV values
def group_by_statement
+ return unless field_format.in?(%w[list date bool int])
+
return order_statement unless field_format == "list"
if multi_value?
diff --git a/app/models/queries/work_packages/selects/custom_field_select.rb b/app/models/queries/work_packages/selects/custom_field_select.rb
index b1c089ff825..5c6931cd6e4 100644
--- a/app/models/queries/work_packages/selects/custom_field_select.rb
+++ b/app/models/queries/work_packages/selects/custom_field_select.rb
@@ -35,14 +35,10 @@ class Queries::WorkPackages::Selects::CustomFieldSelect < Queries::WorkPackages:
@name = custom_field.column_name.to_sym
@sortable = custom_field.order_statement || false
@sortable_join = custom_field.order_join_statement || false
- @groupable = groupable_custom_field?(custom_field) ? custom_field.group_by_statement || false : false
+ @groupable = custom_field.group_by_statement || false
@summable = summable_statement
end
- def groupable_custom_field?(custom_field)
- %w(list date bool int).include?(custom_field.field_format)
- end
-
def caption
@cf.name
end