group_by-fix
This commit is contained in:
parent
a4411cfa34
commit
fce78df549
|
@ -39,7 +39,7 @@ from resolvers.reader import (
|
||||||
load_shouts_search,
|
load_shouts_search,
|
||||||
load_shouts_unrated,
|
load_shouts_unrated,
|
||||||
load_shouts_coauthored,
|
load_shouts_coauthored,
|
||||||
load_shouts_discussed
|
load_shouts_discussed,
|
||||||
)
|
)
|
||||||
from resolvers.topic import (
|
from resolvers.topic import (
|
||||||
get_topic,
|
get_topic,
|
||||||
|
|
|
@ -37,8 +37,6 @@ def add_reaction_stat_columns(q, aliased_reaction):
|
||||||
return q
|
return q
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def is_featured_author(session, author_id):
|
def is_featured_author(session, author_id):
|
||||||
"""checks if author has at least one featured publication"""
|
"""checks if author has at least one featured publication"""
|
||||||
return (
|
return (
|
||||||
|
@ -521,7 +519,6 @@ async def load_shouts_followed_by(_, info, slug: str, limit=50, offset=0) -> Lis
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@query.field("load_shout_ratings")
|
@query.field("load_shout_ratings")
|
||||||
async def load_shout_ratings(_, info, shout: int, limit=100, offset=0):
|
async def load_shout_ratings(_, info, shout: int, limit=100, offset=0):
|
||||||
"""
|
"""
|
||||||
|
@ -585,7 +582,7 @@ async def load_shout_comments(_, info, shout: int, limit=50, offset=0):
|
||||||
|
|
||||||
# filter, group, order, limit, offset
|
# filter, group, order, limit, offset
|
||||||
q = q.filter(and_(Reaction.deleted_at.is_(None), Reaction.shout == shout, Reaction.body.is_not(None)))
|
q = q.filter(and_(Reaction.deleted_at.is_(None), Reaction.shout == shout, Reaction.body.is_not(None)))
|
||||||
q = q.group_by(Reaction.id)
|
q = q.group_by(Reaction.id, Author.user, Shout.id)
|
||||||
q = q.order_by(desc(Reaction.created_at))
|
q = q.order_by(desc(Reaction.created_at))
|
||||||
q = q.limit(limit).offset(offset)
|
q = q.limit(limit).offset(offset)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user