authors-stat-fix

This commit is contained in:
Untone 2024-04-09 21:06:34 +03:00
parent 10c24fe400
commit 6703e3d093

View File

@ -25,7 +25,7 @@ def add_topic_stat_columns(q):
aliased_authors.author == Author.id, aliased_authors.author == Author.id,
Topic.id.in_(select(ShoutTopic.topic).where(ShoutTopic.shout == aliased_shout.id)) Topic.id.in_(select(ShoutTopic.topic).where(ShoutTopic.shout == aliased_shout.id))
)) ))
q = q.add_columns(func.count(distinct(aliased_authors.author_id)).label('authors_stat')) q = q.add_columns(func.count(distinct(aliased_authors.author)).label('authors_stat'))
# followers # followers
q = q.outerjoin(aliased_followers, aliased_followers.topic == Topic.id) q = q.outerjoin(aliased_followers, aliased_followers.topic == Topic.id)