diff options
author | Yorhel <git@yorhel.nl> | 2019-12-20 13:14:54 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-12-20 13:14:54 +0100 |
commit | 13287329e70cbaf155c85e3054f2496411e21b21 (patch) | |
tree | 40a2296b614bc7557c787e5649ea92b33f7f8949 /lib | |
parent | be4a058f9c78a1b73dd6ac848c5becb62c2199ca (diff) |
Discussions::Thread: Ignore poll votes from ign_votes users
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNWeb/Discussions/Thread.pm | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/VNWeb/Discussions/Thread.pm b/lib/VNWeb/Discussions/Thread.pm index 1ddaed78..a5aeb8bd 100644 --- a/lib/VNWeb/Discussions/Thread.pm +++ b/lib/VNWeb/Discussions/Thread.pm @@ -143,9 +143,10 @@ TUWF::get qr{/$RE{tid}(?:/$RE{num})?}, sub { ); my $poll_options = $t->{poll_question} && tuwf->dbAlli( - 'SELECT tpo.id, tpo.option, count(tpv.uid) as votes, tpm.optid IS NOT NULL as my + 'SELECT tpo.id, tpo.option, count(u.id) as votes, tpm.optid IS NOT NULL as my FROM threads_poll_options tpo LEFT JOIN threads_poll_votes tpv ON tpv.optid = tpo.id + LEFT JOIN users u ON tpv.uid = u.id AND NOT u.ign_votes LEFT JOIN threads_poll_votes tpm ON tpm.optid = tpo.id AND tpm.uid =', \auth->uid, ' WHERE tpo.tid =', \$id, ' GROUP BY tpo.id, tpo.option, tpm.optid' @@ -156,7 +157,7 @@ TUWF::get qr{/$RE{tid}(?:/$RE{num})?}, sub { elm_ 'Discussions.Poll' => $POLL_OUT, { question => $t->{poll_question}, max_options => $t->{poll_max_options}, - num_votes => tuwf->dbVali('SELECT COUNT(DISTINCT uid) FROM threads_poll_votes WHERE tid =', \$id), + num_votes => tuwf->dbVali('SELECT COUNT(DISTINCT tpv.uid) FROM threads_poll_votes tpv JOIN users u ON tpv.uid = u.id WHERE NOT u.ign_votes AND tid =', \$id), preview => !!tuwf->reqGet('pollview'), # Old non-Elm way to preview poll results can_vote => !!auth, tid => $id, |