diff options
Diffstat (limited to 'lib/VNDB/Handler/VNPage.pm')
-rw-r--r-- | lib/VNDB/Handler/VNPage.pm | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index 2bfe4eac..57773839 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -467,35 +467,12 @@ sub _stats { my($self, $v) = @_; my $stats = $self->dbVoteStats(vid => $v->{id}); - my($max, $count, $total) = (0, 0); - for (0..$#$stats) { - $max = $stats->[$_] if $stats->[$_] > $max; - $count += $stats->[$_]; - $total += $stats->[$_]*($_+1); - } - div class => 'mainbox'; h1 'User stats'; - if(!$max) { + if(!grep $_ > 0, @$stats) { p "Nobody has voted on this visual novel yet..."; } else { - table class => 'votegraph'; - thead; Tr; - td colspan => 2, 'Vote graph'; - end; end; - for (reverse 0..$#$stats) { - Tr; - td class => 'number', $_+1; - td class => 'graph'; - div style => 'width: '.($stats->[$_] ? $stats->[$_]/$max*250 : 0).'px', ' '; - txt $stats->[$_]; - end; - end; - } - tfoot; Tr; - td colspan => 2, sprintf '%d votes total, average %.2f (%s)', $count, $total/$count, $self->{votes}[sprintf '%.0f', $total/$count-1]; - end; end; - end; + $self->htmlVoteStats(v => $v, $stats); } end; } |