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
squish and reformat other sql chunks
Ivan Kuchinc768f8be4f18
diff --git a/app/models/custom_field/order_statements.rb b/app/models/custom_field/order_statements.rbindex 5181381b6b0..98c46c8c816 100644--- a/app/models/custom_field/order_statements.rb+++ b/app/models/custom_field/order_statements.rb@@ -75,34 +75,46 @@ module CustomField::OrderStatementsdef coalesce_select_custom_value_as_string# COALESCE is here to make sure that blank and NULL values are sorted equally- <<-SQL+ <<-SQL.squishCOALESCE(#{select_custom_value_as_string}, '')SQLenddef select_custom_value_as_string- <<-SQL- (SELECT cv_sort.value FROM #{CustomValue.quoted_table_name} cv_sort- WHERE #{cv_sort_only_custom_field_condition_sql}- LIMIT 1)+ <<-SQL.squish+ (+ SELECT cv_sort.value+ FROM #{CustomValue.quoted_table_name} cv_sort+ WHERE #{cv_sort_only_custom_field_condition_sql}+ LIMIT 1+ )SQLenddef select_custom_values_as_group- <<-SQL- COALESCE((SELECT string_agg(cv_sort.value, '.') FROM #{CustomValue.quoted_table_name} cv_sort- WHERE #{cv_sort_only_custom_field_condition_sql}- AND cv_sort.value IS NOT NULL), '')+ <<-SQL.squish+ COALESCE(+ (+ SELECT string_agg(cv_sort.value, '.')+ FROM #{CustomValue.quoted_table_name} cv_sort+ WHERE #{cv_sort_only_custom_field_condition_sql}+ AND cv_sort.value IS NOT NULL+ ),+ ''+ )SQLenddef select_custom_value_as_decimal- <<-SQL- (SELECT CAST(cv_sort.value AS decimal(60,3)) FROM #{CustomValue.quoted_table_name} cv_sort- WHERE #{cv_sort_only_custom_field_condition_sql}- AND cv_sort.value <> ''- AND cv_sort.value IS NOT NULL- LIMIT 1)+ <<-SQL.squish+ (+ SELECT CAST(cv_sort.value AS decimal(60,3))+ FROM #{CustomValue.quoted_table_name} cv_sort+ WHERE #{cv_sort_only_custom_field_condition_sql}+ AND cv_sort.value <> ''+ AND cv_sort.value IS NOT NULL+ LIMIT 1+ )SQLend@@ -157,7 +169,7 @@ module CustomField::OrderStatementsenddef cv_sort_only_custom_field_condition_sql- <<-SQL+ <<-SQL.squishcv_sort.customized_type='#{self.class.customized_class.name}'AND cv_sort.customized_id=#{self.class.customized_class.quoted_table_name}.idAND cv_sort.custom_field_id=#{id}