Skip to content

Commit

Permalink
Merge branch '2953-strange-facet-item-order' of https://github.com/to…
Browse files Browse the repository at this point in the history
…rfsen/ckan into torfsen-2953-strange-facet-item-order
  • Loading branch information
amercader committed May 10, 2016
2 parents fde8331 + 7cac4e1 commit 667cd99
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ckan/lib/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,8 @@ def get_facet_items_dict(facet, limit=None, exclude_active=False):
facets.append(dict(active=False, **facet_item))
elif not exclude_active:
facets.append(dict(active=True, **facet_item))
facets = sorted(facets, key=lambda item: item['count'], reverse=True)
# Sort descendingly by count and ascendingly by case-sensitive display name
facets.sort(key=lambda it: (-it['count'], it['display_name'].lower()))
if c.search_facets_limits and limit is None:
limit = c.search_facets_limits.get(facet)
# zero treated as infinite for hysterical raisins
Expand Down

0 comments on commit 667cd99

Please sign in to comment.