reactions-order-fix
This commit is contained in:
parent
10be35c78c
commit
3a0683137d
|
@ -384,8 +384,13 @@ async def load_reactions_by(_, info, by, limit=50, offset=0):
|
|||
q = q.group_by(Reaction.id, Author.id, Shout.id, aliased_reaction.created_at)
|
||||
|
||||
# order by
|
||||
order_way = asc if by.get("sort", "").startswith("-") else desc
|
||||
order_field = by.get("sort", "").replace("-", "") or "created_at"
|
||||
order_way = asc
|
||||
order_field = by.get("sort", "").replace("-", "")
|
||||
if by.get("sort", "").startswith("-"):
|
||||
order_way = desc
|
||||
if not order_field:
|
||||
order_field = "created_at"
|
||||
order_way = desc
|
||||
q = q.order_by(order_way(order_field))
|
||||
|
||||
# pagination
|
||||
|
|
Loading…
Reference in New Issue
Block a user