topic followers fix

This commit is contained in:
bniwredyc 2023-02-05 11:39:45 +01:00
parent 14d52f1c55
commit c7c9afdfa9

View File

@ -17,11 +17,7 @@ def add_topic_stat_columns(q):
func.count(distinct(ShoutTopic.shout)).label('shouts_stat')
).outerjoin(aliased_shout_author, ShoutTopic.shout == aliased_shout_author.shout).add_columns(
func.count(distinct(aliased_shout_author.user)).label('authors_stat')
).outerjoin(aliased_topic_follower,
and_(
aliased_topic_follower.topic == Topic.id,
aliased_topic_follower.follower == aliased_shout_author.id
)).add_columns(
).outerjoin(aliased_topic_follower).add_columns(
func.count(distinct(aliased_topic_follower.follower)).label('followers_stat')
)