refine voting and selection in general
This commit is contained in:
parent
4290688acb
commit
aded75af95
|
@ -26,7 +26,8 @@ try:
|
||||||
db.exec(sql"""create table if not exists votes (
|
db.exec(sql"""create table if not exists votes (
|
||||||
id integer primary key,
|
id integer primary key,
|
||||||
quoteid integer,
|
quoteid integer,
|
||||||
ip TEXT UNIQUE);""")
|
ip TEXT,
|
||||||
|
UNIQUE (quoteid, ip));""")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
db.exec(sql"""ALTER TABLE quotes
|
db.exec(sql"""ALTER TABLE quotes
|
||||||
|
@ -176,7 +177,7 @@ routes:
|
||||||
|
|
||||||
case @"kind":
|
case @"kind":
|
||||||
of "browse":
|
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"
|
title = "page " & @"id"
|
||||||
of "quotes":
|
of "quotes":
|
||||||
|
@ -187,7 +188,7 @@ routes:
|
||||||
if (@"kind").startsWith "hashtag-":
|
if (@"kind").startsWith "hashtag-":
|
||||||
let channel = (@"kind").replace("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"
|
title = channel & " page " & @"id"
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
--define:release
|
||||||
|
--deadCodeElim:on
|
Loading…
Reference in New Issue