summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler/VNBrowse.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-01-10 10:27:33 +0100
committerYorhel <git@yorhel.nl>2009-01-10 10:27:33 +0100
commit49814b83b322adea8b2c385dfbb8300c0e2a2ebc (patch)
treeab5b8bd773620e8135014a3f9c5c76d95d4485b3 /lib/VNDB/Handler/VNBrowse.pm
parent9663376cd572b6f94c83f9a580c25fbd2bdc67f2 (diff)
Added VN popularity ranking
The following query should be run periodically to update the rankings: SELECT update_vnpopularity(); I'll fix Multi::Maintenance to do this automatically.
Diffstat (limited to 'lib/VNDB/Handler/VNBrowse.pm')
-rw-r--r--lib/VNDB/Handler/VNBrowse.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/VNDB/Handler/VNBrowse.pm b/lib/VNDB/Handler/VNBrowse.pm
index 8af5791e..d7cacaa0 100644
--- a/lib/VNDB/Handler/VNBrowse.pm
+++ b/lib/VNDB/Handler/VNBrowse.pm
@@ -16,7 +16,7 @@ sub list {
my($self, $char) = @_;
my $f = $self->formValidate(
- { name => 's', required => 0, default => 'title', enum => [ qw|title rel| ] },
+ { name => 's', required => 0, default => 'title', enum => [ qw|title rel pop| ] },
{ name => 'o', required => 0, default => 'a', enum => [ 'a','d' ] },
{ name => 'p', required => 0, default => 1, template => 'int' },
{ name => 'q', required => 0, default => '' },
@@ -61,7 +61,7 @@ sub list {
$q ? ( search => $q ) : (),
results => 50,
page => $f->{p},
- order => ($f->{s} eq 'rel' ? 'c_released' : 'title').($f->{o} eq 'a' ? ' ASC' : ' DESC'),
+ order => ($f->{s} eq 'rel' ? 'c_released' : $f->{s} eq 'pop' ? 'c_popularity' : 'title').($f->{o} eq 'a' ? ' ASC' : ' DESC'),
@cati ? ( cati => \@cati ) : (),
@cate ? ( cate => \@cate ) : (),
@lang ? ( lang => \@lang ) : (),
@@ -85,6 +85,7 @@ sub list {
[ '', 0 ],
[ '', 0 ],
[ 'Released', 'rel' ],
+ [ 'Popularity', 'pop' ],
],
row => sub {
my($s, $n, $l) = @_;
@@ -103,6 +104,7 @@ sub list {
td class => 'tc4';
lit monthstr $l->{c_released};
end;
+ td class => 'tc5', sprintf '%.2f', $l->{c_popularity}*100;
end;
},
);