fmt
All checks were successful
Deploy on push / deploy (push) Successful in 58s

This commit is contained in:
2024-04-25 12:07:30 +03:00
parent e68196ce0b
commit 27d5272032
6 changed files with 18 additions and 32 deletions

View File

@@ -16,9 +16,7 @@ def add_topic_stat_columns(q):
func.count(distinct(aliased_shout.shout)).label("shouts_stat")
)
aliased_follower = aliased(TopicFollower)
q = q.outerjoin(
aliased_follower, aliased_follower.topic == Topic.id
).add_columns(
q = q.outerjoin(aliased_follower, aliased_follower.topic == Topic.id).add_columns(
func.count(distinct(aliased_follower.follower)).label("followers_stat")
)
@@ -27,8 +25,6 @@ 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(
@@ -116,6 +112,7 @@ def get_topic_comments_stat(topic_id: int):
result = local_session().execute(q).first()
return result[0] if result else 0
def get_author_shouts_stat(author_id: int):
aliased_shout_author = aliased(ShoutAuthor)
q = select(func.count(distinct(aliased_shout_author.shout))).filter(