sql-text-fix-order
All checks were successful
Deploy on push / deploy (push) Successful in 1m56s

This commit is contained in:
2024-02-25 17:49:15 +03:00
parent 26c12b2aad
commit 2e635abe5e
3 changed files with 8 additions and 8 deletions

View File

@@ -144,9 +144,9 @@ async def load_shouts_by(_, _info, options):
# order
order_by = Shout.featured_at if filters.get('featured') else Shout.published_at
order_by_str = options.get('order_by')
if order_by_str:
order_by = text(order_by_str)
order_str = options.get('order_by')
if order_str in ['likes', 'shouts', 'followers', 'comments', 'last_comment']:
q = q.order_by(text(f'{order_str}_stat'))
query_order_by = (
desc(order_by) if options.get('order_by_desc', True) else asc(order_by)
)