diff options
| author | schneefux <schneefux+commit@schneefux.xyz> | 2016-06-04 17:31:29 +0200 |
|---|---|---|
| committer | schneefux <schneefux+commit@schneefux.xyz> | 2016-06-04 17:31:29 +0200 |
| commit | 2405aeba0538dcd001fee1d4189fa540447ded2b (patch) | |
| tree | 7f27fdc69f94bcb2e994f2ce410d9b2f967a5e2e | |
| parent | 39a579486583641f176fcc83f54441e6c31ae3d0 (diff) | |
| download | jokevote-2405aeba0538dcd001fee1d4189fa540447ded2b.tar.gz jokevote-2405aeba0538dcd001fee1d4189fa540447ded2b.zip | |
weight user's votes so that the score looks better
| -rw-r--r-- | app.py | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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'] |
