groupby-fix

This commit is contained in:
tonyrewin 2022-11-15 13:25:36 +03:00
parent 4b8f1798ff
commit d9189fb48b

View File

@ -64,7 +64,7 @@ async def load_shouts_by(_, info, by, amount=50, offset=0):
if by.get("days"):
before = datetime.now() - timedelta(days=int(by["days"]) or 30)
q = q.filter(Shout.createdAt > before)
q = q.group_by(Shout.id).order_by(
q = q.group_by(Shout.id, Reaction.id).order_by(
desc(by.get("order") or "createdAt")
).limit(amount).offset(offset)