summaryrefslogtreecommitdiff
path: root/lib/VNDB/DB/ULists.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-09-24 14:07:26 +0200
committerYorhel <git@yorhel.nl>2009-09-24 14:09:43 +0200
commitac3b0e35977653d53cb96854986e8fca2b16ca69 (patch)
treeade184fd454f5be2b16693ebd5e38a6a6f55fc06 /lib/VNDB/DB/ULists.pm
parentdefecb123e03d098283d53af02f2c494f90922aa (diff)
parentd1e395e4197c40b7fd26f1b2dcf75a96d4b2b99e (diff)
Merge branch 'beta'2.7
+ updated changelog
Diffstat (limited to 'lib/VNDB/DB/ULists.pm')
-rw-r--r--lib/VNDB/DB/ULists.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/VNDB/DB/ULists.pm b/lib/VNDB/DB/ULists.pm
index 34bdc2aa..e9b38e57 100644
--- a/lib/VNDB/DB/ULists.pm
+++ b/lib/VNDB/DB/ULists.pm
@@ -155,6 +155,7 @@ sub dbVoteGet {
$o{uid} ? ( 'n.uid = ?' => $o{uid} ) : (),
$o{vid} ? ( 'n.vid = ?' => $o{vid} ) : (),
$o{hide} ? ( 'u.show_list = TRUE' => 1 ) : (),
+ $o{hide_ign} ? ( '(NOT u.ign_votes OR u.id = ?)' => $self->authInfo->{id}||0 ) : (),
);
my @select = (
@@ -186,16 +187,19 @@ sub dbVoteGet {
}
-# Arguments: (uid|vid), id
+# Arguments: (uid|vid), id, use_ignore_list
# Returns an arrayref with 10 elements containing the number of votes for index+1
sub dbVoteStats {
- my($self, $col, $id) = @_;
+ my($self, $col, $id, $ign) = @_;
+ my $u = $self->authInfo->{id};
my $r = [ qw| 0 0 0 0 0 0 0 0 0 0 | ];
$r->[$_->{vote}-1] = $_->{votes} for (@{$self->dbAll(q|
SELECT vote, COUNT(vote) as votes
FROM votes
+ !s
!W
GROUP BY vote|,
+ $ign ? 'JOIN users ON id = uid AND (NOT ign_votes'.($u?sprintf(' OR id = %d',$u):'').')' : '',
$col ? { '!s = ?' => [ $col, $id ] } : {},
)});
return $r;