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
fix grouping by cf while summing (#8881)
ulfertsbf9bc70bb18d
diff --git a/app/models/custom_field/order_statements.rb b/app/models/custom_field/order_statements.rbindex 24694a267a5..82cae3e1e04 100644--- a/app/models/custom_field/order_statements.rb+++ b/app/models/custom_field/order_statements.rb@@ -43,7 +43,7 @@ module CustomField::OrderStatementsif multi_value?[select_custom_values_as_group]else- coalesce_select_custom_value_as_string+ [coalesce_select_custom_value_as_string]endwhen 'int', 'float'# Make the database cast values into numeric@@ -73,12 +73,12 @@ module CustomField::OrderStatements# Returns the grouping result# which differ for multi-value select fields,# because in this case we do want the primary CV values- def group_by_statements+ def group_by_statementreturn order_statements unless field_format == 'list'if multi_value?# We want to return the internal IDs in the case of grouping- [select_custom_values_as_group]+ select_custom_values_as_groupelsecoalesce_select_custom_value_as_stringend@@ -88,11 +88,9 @@ module CustomField::OrderStatementsdef coalesce_select_custom_value_as_string# COALESCE is here to make sure that blank and NULL values are sorted equally- [- <<-SQL- COALESCE(#{select_custom_value_as_string}, '')- SQL- ]+ <<-SQL+ COALESCE(#{select_custom_value_as_string}, '')+ SQLenddef select_custom_value_as_stringdiff --git a/app/models/queries/work_packages/columns/custom_field_column.rb b/app/models/queries/work_packages/columns/custom_field_column.rbindex 3f0ac753e48..24676fca2bf 100644--- a/app/models/queries/work_packages/columns/custom_field_column.rb+++ b/app/models/queries/work_packages/columns/custom_field_column.rb@@ -81,7 +81,7 @@ class Queries::WorkPackages::Columns::CustomFieldColumn < Queries::WorkPackages:enddef set_groupable!- self.groupable = custom_field.group_by_statements if groupable_custom_field?(custom_field)+ self.groupable = custom_field.group_by_statement if groupable_custom_field?(custom_field)self.groupable ||= falseend