Skip to content

Commit

Permalink
more evenly distributed tags
Browse files Browse the repository at this point in the history
  • Loading branch information
yanick committed Dec 14, 2010
1 parent 82271c0 commit 6441d1d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Galuga/Controller/Root.pm
Expand Up @@ -33,11 +33,16 @@ sub tags :Path('tags') :Args(0) {
my ( $self, $c ) = @_;

# get all tags and their tally
my %tags = map { $_->label => $_->count_related( 'entry_tags' ) } $c->model('DB::Tags')->search->all;
my @tags = sort { $tags{$a} <=> $tags{$b} } keys %tags;

for my $i ( 0..$#tags ) {
$tags{$tags[$i]} = int( 24 * ($i+1) / @tags );
}

$c->stash->{tags} = {
map { $_->label => $_->count_related( 'entry_tags' ) } $c->model('DB::Tags')->search->all
};
$c->stash->{tags} = \%tags;

return;
}

sub entries :Path( 'entries' ) :Args(0) {
Expand Down

0 comments on commit 6441d1d

Please sign in to comment.