From 1b222762378c0095f88dc6f865d72370622fa874 Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 25 Apr 2024 11:20:57 +0300 Subject: [PATCH] get-topic-fix --- resolvers/stat.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resolvers/stat.py b/resolvers/stat.py index 2f6f8a82..1d15ea3e 100644 --- a/resolvers/stat.py +++ b/resolvers/stat.py @@ -15,6 +15,8 @@ def add_topic_stat_columns(q): q = q.outerjoin(aliased_shout).add_columns( func.count(distinct(aliased_shout.shout)).label("shouts_stat") ) + # Join the Topic table with the Author table + q = q.join(Author, TopicFollower.author == Author.id) aliased_follower = aliased(TopicFollower) q = q.outerjoin( aliased_follower, aliased_follower.follower == Author.id @@ -27,6 +29,7 @@ def add_topic_stat_columns(q): return q + def add_author_stat_columns(q): aliased_shout = aliased(ShoutAuthor) q = q.outerjoin(aliased_shout).add_columns(