From 444f1107fd8bb195324c960c384875ab2e0bbc12 Mon Sep 17 00:00:00 2001 From: yorhel Date: Sun, 13 Jul 2008 11:35:46 +0000 Subject: Re-added the vote stats to VN pages, Searching for 'Chinese' doesn't select 'NES' and Place/time category order on VN pages is now consistent git-svn-id: svn://vndb.org/vndb@66 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b --- data/tpl/vnpage | 3 ++- data/tpl/vnpage_stats | 13 +++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'data') diff --git a/data/tpl/vnpage b/data/tpl/vnpage index 19061249..123a3147 100644 --- a/data/tpl/vnpage +++ b/data/tpl/vnpage @@ -111,7 +111,8 @@ if($d{vn}{length} || $d{vn}{alias} || @links || $prod) { ]]
[[: $VNDB::CAT->{$c}[0] ]]
[[= join(', ', @c) ]]
[[ } } ]] [[ if(grep $_->[0] =~ /^[tl]/, @{$d{vn}{categories}}) { ]]- -
Place/Time
[[= join ', ', map $VNDB::CAT->{substr($_->[0],0,1)}[1]{substr($_->[0],1,2)}, sort grep $_->[0] =~ /^[tl]/, @{$d{vn}{categories}} ]]
+
Place/Time
[[= join ', ', map $VNDB::CAT->{substr($_->[0],0,1)}[1]{substr($_->[0],1,2)}, + sort { $a->[0] cmp $b->[0] } grep $_->[0] =~ /^[tl]/, @{$d{vn}{categories}} ]]
[[ } ]]- [[ } ]]- diff --git a/data/tpl/vnpage_stats b/data/tpl/vnpage_stats index d5d002a7..841fce37 100644 --- a/data/tpl/vnpage_stats +++ b/data/tpl/vnpage_stats @@ -2,16 +2,13 @@ [[ my $max = 1; my $total = 0; my $sum = 0; - - if($d{votes}{graph}) { - for (0..$#{$d{votes}{graph}}) { - $total += $d{votes}{graph}[$_]; - $max = $d{votes}{graph}[$_] if $d{votes}{graph}[$_] > $max; - $sum += ($_+1) * $d{votes}{graph}[$_]; - } + for (0..$#{$d{votes}{graph}}) { + $total += $d{votes}{graph}[$_]; + $max = $d{votes}{graph}[$_] if $d{votes}{graph}[$_] > $max; + $sum += ($_+1) * $d{votes}{graph}[$_]; } ]] -[[ if($d{votes}{graph} && $d{pv} && $d{user}{votes}) { ]]- +[[ if(!$d{user} || ($d{pv} && $d{user}{votes})) { ]]-
  • Vote graph

    [[= $total ]]- vote[[= $total==1?'':'s' ]]- total [[= $total ? sprintf(', average: %.1f.', $sum/$total) : '' ]]

    -- cgit v1.2.3