Skip to content

Commit

Permalink
is ensuring false instead of nil needed?
Browse files Browse the repository at this point in the history
  • Loading branch information
toy committed Oct 7, 2024
1 parent 266ecf3 commit 951325e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/models/custom_field/order_statements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ def order_statement
case field_format
when "string", "date", "bool", "link", "int", "float", "list", "user", "version"
"cf_order_#{id}.value"
else
false
end
end

Expand Down Expand Up @@ -69,6 +67,8 @@ def order_null_handling(asc)
# 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?
Expand Down
10 changes: 3 additions & 7 deletions app/models/queries/work_packages/selects/custom_field_select.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,12 @@ def initialize(custom_field)
@cf = custom_field

@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
@sortable = custom_field.order_statement
@sortable_join = custom_field.order_join_statement
@groupable = custom_field.group_by_statement
@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
Expand Down

0 comments on commit 951325e

Please sign in to comment.