Skip to content

Commit

Permalink
[59174] Fixed group row name rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
apfohl committed Dec 4, 2024
1 parent f68bdc4 commit 6937a73
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/custom_field/hierarchy/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ class CustomField::Hierarchy::Item < ApplicationRecord

scope :including_children, -> { includes(children: :children) }

def to_s = label
def to_s = short.nil? ? label : "#{label} (#{short})"
end
15 changes: 8 additions & 7 deletions lib/api/decorators/aggregation_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ def initialize(group_key, count, query:, current_user:)
@count = count
@query = query

if group_key.is_a?(Array)
group_key = set_links!(group_key)
end

@link = ::API::V3::Utilities::ResourceLinkGenerator.make_link(group_key)
@link = ::API::V3::Utilities::ResourceLinkGenerator.make_link(
group_key.is_a?(Array) ? set_links!(group_key) : group_key
)

super(group_key, current_user:)
end
Expand Down Expand Up @@ -86,10 +84,13 @@ def set_links!(group_key)
end

def value
if represented == true || represented == false
case represented
when TrueClass || FalseClass
represented
when Array
represented.map(&:to_s).join(", ")
else
represented ? represented.to_s : nil
represented&.to_s
end
end

Expand Down

0 comments on commit 6937a73

Please sign in to comment.