refine voting and selection in general

This commit is contained in:
Christine Dodrill 2016-02-06 00:38:31 -08:00
parent 4290688acb
commit aded75af95
2 changed files with 6 additions and 3 deletions

View File

@ -26,7 +26,8 @@ try:
db.exec(sql"""create table if not exists votes (
id integer primary key,
quoteid integer,
ip TEXT UNIQUE);""")
ip TEXT,
UNIQUE (quoteid, ip));""")
try:
db.exec(sql"""ALTER TABLE quotes
@ -176,7 +177,7 @@ routes:
case @"kind":
of "browse":
rows = db.getAllRows(sql"SELECT * FROM quotes ORDER BY time desc LIMIT 20 OFFSET ?", (qid * 20))
rows = db.getAllRows(sql"SELECT * FROM quotes where deleted=0 ORDER BY time desc LIMIT 20 OFFSET ?", (qid * 20))
title = "page " & @"id"
of "quotes":
@ -187,7 +188,7 @@ routes:
if (@"kind").startsWith "hashtag-":
let channel = (@"kind").replace("hashtag-", "#")
rows = db.getAllRows(sql"SELECT * FROM quotes WHERE channel=? ORDER BY time desc LIMIT 20 OFFSET ?", channel, qid * 20)
rows = db.getAllRows(sql"SELECT * FROM quotes WHERE channel=?, deleted=0 ORDER BY time desc LIMIT 20 OFFSET ?", channel, qid * 20)
title = channel & " page " & @"id"
else:

View File

@ -0,0 +1,2 @@
--define:release
--deadCodeElim:on