Skip to content

Commit

Permalink
fix bool handling in facets
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 16, 2021
1 parent 3fa19e6 commit d4d91b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/controllers/concerns/facetable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,11 @@ def facet_by_key(arr)
end

def facet_by_bool(arr)
values = { 0 => "no", 1 => "yes" }
id = hsh["key"] == 1 ? "true" : "false"
arr.map do |hsh|
{
"id" => hsh["key"],
"title" => values[hsh["key"]],
"id" => id,
"title" => id.capitalize,
"count" => hsh["doc_count"],
}
end
Expand Down
6 changes: 3 additions & 3 deletions app/graphql/types/base_connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ def facet_by_key(arr)
end

def facet_by_bool(arr)
values = { 0 => "no", 1 => "yes" }
id = hsh["key"] == 1 ? "true" : "false"
arr.map do |hsh|
{
"id" => hsh["key"],
"title" => values[hsh["key"]],
"id" => id,
"title" => id.capitalize,
"count" => hsh["doc_count"],
}
end
Expand Down

0 comments on commit d4d91b4

Please sign in to comment.