Fix thread with no comments not being shown

This commit is contained in:
David Hoppenbrouwers
2022-10-08 10:52:16 +02:00
parent 2ceb4481b2
commit 55285b82cc

View File

@@ -31,9 +31,10 @@ class DB:
def get_threads(self, forum_id): def get_threads(self, forum_id):
return self._db().execute(''' return self._db().execute('''
select t.thread_id, title, t.create_time, t.update_time, t.author_id, name, count(1) select t.thread_id, title, t.create_time, t.update_time, t.author_id, name, count(c.thread_id)
from threads t, users, comments c from threads t, users
where forum_id = ? and user_id = t.author_id and t.thread_id = c.thread_id left join comments c on t.thread_id = c.thread_id
where forum_id = ? and user_id = t.author_id
group by t.thread_id group by t.thread_id
''', ''',
(forum_id,) (forum_id,)