no-distinct
All checks were successful
Deploy on push / deploy (push) Successful in 30s

This commit is contained in:
Untone 2024-02-26 20:05:07 +03:00
parent 02b2aad813
commit 02b504cc4f
2 changed files with 4 additions and 5 deletions

View File

@ -356,10 +356,9 @@ async def load_reactions_by(_, info, by, limit=50, offset=0):
"""
q = (
select(Reaction, Author, Shout)
select([Reaction, Author, Shout])
.join(Author, Reaction.created_by == Author.id)
.join(Shout, Reaction.shout == Shout.id)
.distinct() # Применяем DISTINCT здесь
)
# calculate counters

View File

@ -85,10 +85,10 @@ def add_author_stat_columns(q):
# aliased_reaction.kind == ReactionKind.COMMENT.value,
# aliased_reaction.deleted_at.is_(None),
# ),
#)
#.add_columns(
# )
# .add_columns(
# func.count(distinct(aliased_reaction.id)).label('comments_stat')
#)
# )
q = q.group_by(Author.id)
return q