From: Dobrica Pavlinusic Date: Wed, 26 May 2010 16:01:43 +0000 (+0200) Subject: sort numeric facets with more than 5 values ascending X-Git-Url: http://git.rot13.org/?p=MojoFacets.git;a=commitdiff_plain;h=736f3989c645cb9e80ce34edcfe201e01dde26ed sort numeric facets with more than 5 values ascending This heuristics allow us to see simple yes/no/maybe lists still as a count, especially if they are numeric --- diff --git a/lib/MojoFacets/Data.pm b/lib/MojoFacets/Data.pm index 65aef48..dee9765 100644 --- a/lib/MojoFacets/Data.pm +++ b/lib/MojoFacets/Data.pm @@ -603,7 +603,8 @@ sub facet { my $numeric = $self->_is_numeric($name); my $sort = $self->param('sort'); - $sort ||= $numeric ? 'a' : 'c'; + # sort numeric facets with more than 5 values ascending + $sort ||= $numeric && $#facet_names > 4 ? 'a' : 'c'; @facet_names = sort { my $result;