Merge branch 'followers-count-fix' into 'main'

topic followers fix

See merge request discoursio/discoursio-api!9
This commit is contained in:
Igor 2023-02-05 10:43:11 +00:00
commit e1e3e9fdde

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')
)