This commit is contained in:
parent
2082e2a6e5
commit
d369cfe333
|
@ -483,12 +483,12 @@ async def load_shouts_discussed(_, info, limit=50, offset=0):
|
||||||
if not author_id:
|
if not author_id:
|
||||||
return []
|
return []
|
||||||
# Subquery to find shout IDs that the author has commented on
|
# Subquery to find shout IDs that the author has commented on
|
||||||
reaction_subquery = (
|
reaction_subquery = (
|
||||||
select(Reaction.shout)
|
select(Reaction.shout)
|
||||||
.distinct() # Ensure distinct shout IDs
|
.distinct() # Ensure distinct shout IDs
|
||||||
.filter(and_(Reaction.created_by == author_id, Reaction.body.is_not(None)))
|
.filter(and_(Reaction.created_by == author_id, Reaction.body.is_not(None)))
|
||||||
.correlate(Shout) # Ensure proper correlation with the main query
|
.correlate(Shout) # Ensure proper correlation with the main query
|
||||||
)
|
)
|
||||||
q, aliased_reaction = query_shouts()
|
q, aliased_reaction = query_shouts()
|
||||||
q = q.filter(Shout.id.in_(reaction_subquery))
|
q = q.filter(Shout.id.in_(reaction_subquery))
|
||||||
return get_shouts_with_stats(q, limit, offset=offset)
|
return get_shouts_with_stats(q, limit, offset=offset)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user