summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/Tags.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-03-07 15:11:58 +0100
committerYorhel <git@yorhel.nl>2009-03-07 15:11:58 +0100
commita9749950a04175cfed998ba9f98fb89a3de1544c (patch)
tree74771e4857a7156d7ea217ffef2210cab78d7c7f /lib/VNDB/DB/Tags.pm
parentafd4fa3f408e5644c207e7c4d15f41ff4889904b (diff)
Hiding spoilers on tag pages
Diffstat (limited to 'lib/VNDB/DB/Tags.pm')
-rw-r--r--lib/VNDB/DB/Tags.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/VNDB/DB/Tags.pm b/lib/VNDB/DB/Tags.pm
index dfa9b6b3..3e06d1b8 100644
--- a/lib/VNDB/DB/Tags.pm
+++ b/lib/VNDB/DB/Tags.pm
@@ -130,21 +130,27 @@ sub dbVNTags {
# Fetch all VNs from a tag, including VNs from child tags, and provide ratings for them.
-# Argument: %options->{ tag order page results }
+# Argument: %options->{ tag order page results maxspoil }
sub dbTagVNs {
my($self, %o) = @_;
$o{order} ||= 'tb.rating DESC';
$o{page} ||= 1;
$o{results} ||= 10;
+ my %where = (
+ 'tag = ?' => $o{tag},
+ defined $o{maxspoil} ? (
+ 'tb.spoiler <= ?' => $o{maxspoil} ) : (),
+ );
+
my($r, $np) = $self->dbPage(\%o, q|
SELECT tb.tag, tb.vid, tb.users, tb.rating, tb.spoiler, vr.title, vr.original, v.c_languages, v.c_released, v.c_platforms, v.c_popularity
FROM tags_vn_bayesian tb
JOIN vn v ON v.id = tb.vid
JOIN vn_rev vr ON vr.id = v.latest
- WHERE tag = ?
+ !W
ORDER BY !s|,
- $o{tag}, $o{order});
+ \%where, $o{order});
return wantarray ? ($r, $np) : $r;
}