This commit is contained in:
parent
a1ee49ba54
commit
d54e2a2f3f
|
@ -73,7 +73,7 @@ async def follow(_, info, what, slug):
|
|||
|
||||
elif what == "COMMUNITY":
|
||||
with local_session() as session:
|
||||
follows = session.execute(select(Community))
|
||||
follows = session.query(Community).all()
|
||||
|
||||
elif what == "SHOUT":
|
||||
error = reactions_follow(follower_id, slug)
|
||||
|
|
|
@ -12,7 +12,9 @@ from services.logger import root_logger as logger
|
|||
|
||||
def add_topic_stat_columns(q):
|
||||
aliased_shout = aliased(ShoutTopic)
|
||||
q = q.outerjoin(aliased_shout).add_columns(func.count(distinct(aliased_shout.shout)).label("shouts_stat"))
|
||||
q = q.outerjoin(aliased_shout, and_(aliased_shout.shout == Shout.id, Shout.deleted_at.is_(None))).add_columns(
|
||||
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(
|
||||
func.count(distinct(aliased_follower.follower)).label("followers_stat")
|
||||
|
@ -25,7 +27,9 @@ def add_topic_stat_columns(q):
|
|||
|
||||
def add_author_stat_columns(q):
|
||||
aliased_shout = aliased(ShoutAuthor)
|
||||
q = q.outerjoin(aliased_shout).add_columns(func.count(distinct(aliased_shout.shout)).label("shouts_stat"))
|
||||
q = q.outerjoin(aliased_shout, and_(aliased_shout.shout == Shout.id, Shout.deleted_at.is_(None))).add_columns(
|
||||
func.count(distinct(aliased_shout.shout)).label("shouts_stat")
|
||||
)
|
||||
aliased_follower = aliased(AuthorFollower)
|
||||
q = q.outerjoin(aliased_follower, aliased_follower.author == Author.id).add_columns(
|
||||
func.count(distinct(aliased_follower.follower)).label("followers_stat")
|
||||
|
|
Loading…
Reference in New Issue
Block a user