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

rename CustomField#null_handling to order_null_handling

Ivan Kuchin544e7d4b8ce7
diff --git a/app/models/custom_field/order_statements.rb b/app/models/custom_field/order_statements.rb
index 79b773ec7db..62484202945 100644
--- a/app/models/custom_field/order_statements.rb
+++ b/app/models/custom_field/order_statements.rb
@@ -48,9 +48,9 @@ module CustomField::OrderStatements
end
end
- ##
- # Returns the null handling for the given direction
- def null_handling(asc)
+ # Returns the ORDER BY option defining order of objects without value for the
+ # custom field.
+ def order_null_handling(asc)
return unless %w[int float].include?(field_format)
null_direction = asc ? "FIRST" : "LAST"
diff --git a/app/models/queries/projects/orders/custom_field_order.rb b/app/models/queries/projects/orders/custom_field_order.rb
index 5b3f235acfc..159d3803448 100644
--- a/app/models/queries/projects/orders/custom_field_order.rb
+++ b/app/models/queries/projects/orders/custom_field_order.rb
@@ -60,7 +60,7 @@ class Queries::Projects::Orders::CustomFieldOrder < Queries::Orders::Base
def order(scope)
order_statement = "#{custom_field.order_statement} #{direction}"
- if (null_handling = custom_field.null_handling(direction == :asc))
+ if (null_handling = custom_field.order_null_handling(direction == :asc))
order_statement = "#{order_statement} #{null_handling}"
end
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 e4b09ad81b9..45953f7ca38 100644
--- a/app/models/queries/work_packages/selects/custom_field_select.rb
+++ b/app/models/queries/work_packages/selects/custom_field_select.rb
@@ -46,7 +46,7 @@ class Queries::WorkPackages::Selects::CustomFieldSelect < Queries::WorkPackages:
@cf.name
end
- delegate :null_handling, to: :custom_field
+ def null_handling(...) = custom_field.order_null_handling(...)
def custom_field
@cf