From 2405aeba0538dcd001fee1d4189fa540447ded2b Mon Sep 17 00:00:00 2001 From: schneefux Date: Sat, 4 Jun 2016 17:31:29 +0200 Subject: weight user's votes so that the score looks better --- app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app.py') diff --git a/app.py b/app.py index 0a3f4ec..502f3c2 100644 --- a/app.py +++ b/app.py @@ -171,9 +171,9 @@ class dbProxy(object): score -= self.c.execute(votewhere + "joke=? AND type='report'", (joke['id'],)).fetchone()['COUNT(*)'] * 5 for u in users: # user's scores count 10 times more - score += self.c.execute(votewhere + "joke=? AND type='up' AND user=?", (joke['id'], u)).fetchone()['COUNT(*)'] * 10 - score -= self.c.execute(votewhere + "joke=? AND type='down' AND user=?", (joke['id'], u)).fetchone()['COUNT(*)'] * 10 - score -= self.c.execute(votewhere + "joke=? AND type='report' AND user=?", (joke['id'], u)).fetchone()['COUNT(*)'] * 50 + score += self.c.execute(votewhere + "joke=? AND type='up' AND user=?", (joke['id'], u)).fetchone()['COUNT(*)'] * 9 + score -= self.c.execute(votewhere + "joke=? AND type='down' AND user=?", (joke['id'], u)).fetchone()['COUNT(*)'] * 9 + score -= self.c.execute(votewhere + "joke=? AND type='report' AND user=?", (joke['id'], u)).fetchone()['COUNT(*)'] * 45 ret_joke['score'] = score ret_joke['freshness'] = jokes[-1]['id'] - joke['id'] -- cgit v1.3.1