Commit 199ee52f6a91606dc47b473d30a4be9190f62b04
1 parent
192e3a65
Exists in
master
and in
28 other branches
Fix sorting of facets with extra label
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
lib/acts_as_faceted.rb
... | ... | @@ -134,7 +134,11 @@ module ActsAsFaceted |
134 | 134 | if facet[:queries_order] |
135 | 135 | facets_data |
136 | 136 | elsif sort_by == :alphabetically |
137 | - facets_data.sort{ |a,b| a[1] <=> b[1] } | |
137 | + facets_data.sort do |a,b| | |
138 | + a = a[1].is_a?(String) ? a[1] : a.first | |
139 | + b = b[1].is_a?(String) ? b[1] : b.first | |
140 | + a <=> b | |
141 | + end | |
138 | 142 | elsif sort_by == :count |
139 | 143 | facets_data.sort{ |a,b| -1*(a[2] <=> b[2]) } |
140 | 144 | else | ... | ... |