Simple view incrementing on /posts request.
This commit is contained in:
parent
40167ef1e4
commit
d20d0e87ec
1 changed files with 3 additions and 1 deletions
|
|
@ -172,7 +172,7 @@ proc checkLoggedIn(c: TForumData) =
|
||||||
else:
|
else:
|
||||||
echo("SID not found in sessions. Assuming logged out.")
|
echo("SID not found in sessions. Assuming logged out.")
|
||||||
|
|
||||||
proc incrementViews(c: TForumData, threadId: int) =
|
proc incrementViews(threadId: int) =
|
||||||
const query = sql"update thread set views = views + 1 where id = ?"
|
const query = sql"update thread set views = views + 1 where id = ?"
|
||||||
exec(db, query, threadId)
|
exec(db, query, threadId)
|
||||||
|
|
||||||
|
|
@ -819,6 +819,8 @@ routes:
|
||||||
else:
|
else:
|
||||||
skippedPosts.add(id)
|
skippedPosts.add(id)
|
||||||
|
|
||||||
|
incrementViews(id)
|
||||||
|
|
||||||
resp $(%list), "application/json"
|
resp $(%list), "application/json"
|
||||||
|
|
||||||
get "/specific_posts.json":
|
get "/specific_posts.json":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue