This commit is contained in:
parent
02b2aad813
commit
02b504cc4f
|
@ -356,10 +356,9 @@ async def load_reactions_by(_, info, by, limit=50, offset=0):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
q = (
|
q = (
|
||||||
select(Reaction, Author, Shout)
|
select([Reaction, Author, Shout])
|
||||||
.join(Author, Reaction.created_by == Author.id)
|
.join(Author, Reaction.created_by == Author.id)
|
||||||
.join(Shout, Reaction.shout == Shout.id)
|
.join(Shout, Reaction.shout == Shout.id)
|
||||||
.distinct() # Применяем DISTINCT здесь
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# calculate counters
|
# calculate counters
|
||||||
|
|
|
@ -85,10 +85,10 @@ def add_author_stat_columns(q):
|
||||||
# aliased_reaction.kind == ReactionKind.COMMENT.value,
|
# aliased_reaction.kind == ReactionKind.COMMENT.value,
|
||||||
# aliased_reaction.deleted_at.is_(None),
|
# aliased_reaction.deleted_at.is_(None),
|
||||||
# ),
|
# ),
|
||||||
#)
|
# )
|
||||||
#.add_columns(
|
# .add_columns(
|
||||||
# func.count(distinct(aliased_reaction.id)).label('comments_stat')
|
# func.count(distinct(aliased_reaction.id)).label('comments_stat')
|
||||||
#)
|
# )
|
||||||
q = q.group_by(Author.id)
|
q = q.group_by(Author.id)
|
||||||
|
|
||||||
return q
|
return q
|
||||||
|
|
Loading…
Reference in New Issue
Block a user