fix subscription unread count calculation
This commit is contained in:
@ -255,8 +255,11 @@ class Subscriptions(Model):
|
||||
q = """SELECT COUNT(*) AS unread_count
|
||||
FROM posts
|
||||
LEFT JOIN subscriptions ON subscriptions.thread_id = posts.thread_id
|
||||
WHERE subscriptions.user_id = ? AND posts.created_at > subscriptions.last_seen"""
|
||||
return db.fetch_one(q, self.user_id)['unread_count']
|
||||
WHERE subscriptions.user_id = ? AND posts.created_at > subscriptions.last_seen AND posts.thread_id = ?"""
|
||||
res = db.fetch_one(q, self.user_id, self.thread_id)
|
||||
if res:
|
||||
return res['unread_count']
|
||||
return None
|
||||
|
||||
class APIRateLimits(Model):
|
||||
table = 'api_rate_limits'
|
||||
|
Reference in New Issue
Block a user