summaryrefslogtreecommitdiff
path: root/util/dump.sql
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-05-09 10:02:46 +0200
committerYorhel <git@yorhel.nl>2009-05-09 10:02:46 +0200
commitce6d43aed955effe136f1ce3682828d2d43109cb (patch)
treee55754ece45875da53568c5e616a36a59540633f /util/dump.sql
parent9909b50b1973d02717c89d4e42b274909d59a0ac (diff)
Don't consider VNs with AVG(vote) < 0 on tag pages
The bayesian ranking algorithm isn't exactly meant to be used to differentiate between absolute values, so do a pre-check on AVG(vote) before considering a VN in the rating. I've also played around with using plain old averages as score, but I'd say the ordering is a lot better with the bayesian ranking, the displayed score is just slightly more confusing.
Diffstat (limited to 'util/dump.sql')
-rw-r--r--util/dump.sql4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/dump.sql b/util/dump.sql
index 5003c6e8..81343307 100644
--- a/util/dump.sql
+++ b/util/dump.sql
@@ -576,8 +576,8 @@ BEGIN
SELECT * FROM tags_vn UNION SELECT * FROM tag_vn_childs();
-- grouped by (tag, vid, uid), so only one user votes on one parent tag per VN entry
CREATE OR REPLACE TEMPORARY VIEW tags_vn_grouped AS
- SELECT tag, vid, uid, AVG(vote)::real AS vote, COALESCE(AVG(spoiler), 0)::real AS spoiler
- FROM tags_vn_all GROUP BY tag, vid, uid;
+ SELECT tag, vid, uid, MAX(vote)::real AS vote, COALESCE(AVG(spoiler), 0)::real AS spoiler
+ FROM tags_vn_all WHERE vote > 0 GROUP BY tag, vid, uid;
-- grouped by (tag, vid) and serialized into a table
DROP INDEX IF EXISTS tags_vn_bayesian_tag;
TRUNCATE tags_vn_bayesian;