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

Revert 10.0 PR

Oliver Günther148efb322d57
diff --git a/app/models/custom_field/order_statements.rb b/app/models/custom_field/order_statements.rb
index dbbf60034ae..ffe4c2af913 100644
--- a/app/models/custom_field/order_statements.rb
+++ b/app/models/custom_field/order_statements.rb
@@ -121,7 +121,7 @@ module CustomField::OrderStatements
<<-SQL
COALESCE((SELECT string_agg(co_sort.value, '.' ORDER BY co_sort.position ASC) FROM #{CustomOption.table_name} co_sort
LEFT JOIN #{CustomValue.table_name} cv_sort
- ON cv_sort.value ~ '^[0-9]+$' AND co_sort.id = cv_sort.value::numeric
+ ON cv_sort.value IS NOT NULL AND co_sort.id = cv_sort.value::numeric
WHERE cv_sort.customized_type='#{self.class.customized_class.name}'
AND cv_sort.customized_id=#{self.class.customized_class.table_name}.id
AND cv_sort.custom_field_id=#{id}), '')
diff --git a/spec/features/custom_fields/multi_value_custom_field_spec.rb b/spec/features/custom_fields/multi_value_custom_field_spec.rb
index 0d9c258d8db..e1e7c2d6408 100644
--- a/spec/features/custom_fields/multi_value_custom_field_spec.rb
+++ b/spec/features/custom_fields/multi_value_custom_field_spec.rb
@@ -225,21 +225,6 @@ describe "multi select custom values", clear_cache: true, js: true do
wp_table.expect_work_package_listed(work_package2)
wp_table.expect_work_package_order work_package, work_package2
end
-
- context 'when one of the custom_values is not numeric' do
- it 'does not break the query (Regression #31123)' do
- # Break one integer custom_value into something not castable
- work_package2.custom_values.first.update_column(:value, 'string value')
-
- wp_table.visit_query query
- wp_table.expect_work_package_listed(work_package)
- wp_table.expect_work_package_listed(work_package2)
-
- expect(wp2_field.display_element).to have_text('string value not found')
- expect(wp1_field.display_element).to have_text('pineapple')
- expect(wp1_field.display_element).to have_text('ham')
- end
- end
end
describe 'sorting by the single select field' do