diff options
author | ubq323 <ubq323> | 2021-07-17 23:27:37 +0000 |
---|---|---|
committer | ubq323 <ubq323> | 2021-07-17 23:27:37 +0000 |
commit | a2c82ca4f96420234460ea5fdea5df37078117d7 (patch) | |
tree | b12848493c3630cb2aab445fc20542736b304ea9 /apioforum/db.py | |
parent | 2eae97d6a08da4b832ccc69ce66bd15009001737 (diff) |
vote meters idk
Diffstat (limited to 'apioforum/db.py')
-rw-r--r-- | apioforum/db.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/apioforum/db.py b/apioforum/db.py index 25bda94..ba1f6a3 100644 --- a/apioforum/db.py +++ b/apioforum/db.py @@ -115,6 +115,10 @@ ALTER TABLE posts ADD COLUMN vote INTEGER REFERENCES votes(id); CREATE VIEW vote_counts AS SELECT poll, option_idx, count(*) AS num FROM votes WHERE current GROUP BY option_idx,poll; """, +""" +CREATE VIEW total_vote_counts AS + SELECT poll, count(*) AS total_votes FROM votes WHERE current GROUP BY poll; +""", ] |