diff --git a/app/graphql/types/base_connection.rb b/app/graphql/types/base_connection.rb index 191891f68..a5dc5ee21 100644 --- a/app/graphql/types/base_connection.rb +++ b/app/graphql/types/base_connection.rb @@ -79,21 +79,12 @@ def facet_by_year(arr) end end - def facet_by_key(arr) + def facet_by_key(arr, title_case: true) arr.map do |hsh| + title = title_case ? hsh["key"].titleize : hsh["key"] { "id" => hsh["key"], - "title" => hsh["key"].titleize, - "count" => hsh["doc_count"], - } - end - end - - def facet_by_key_raw(arr) - arr.map do |hsh| - { - "id" => hsh["key"], - "title" => hsh["key"], + "title" => title, "count" => hsh["doc_count"], } end diff --git a/app/graphql/types/repository_connection_with_total_type.rb b/app/graphql/types/repository_connection_with_total_type.rb index c5e79c53f..50146bc8f 100644 --- a/app/graphql/types/repository_connection_with_total_type.rb +++ b/app/graphql/types/repository_connection_with_total_type.rb @@ -28,7 +28,7 @@ def repository_types end def certificates - facet_by_key_raw(object.aggregations.certificates.buckets) + facet_by_key(object.aggregations.certificates.buckets, title_case: false) end def members