distinct
All checks were successful
Deploy on push / deploy (push) Successful in 29s

This commit is contained in:
Untone 2024-02-26 15:21:12 +03:00
parent ced8c9f75c
commit fec363063d
2 changed files with 4 additions and 1 deletions

View File

@ -114,6 +114,7 @@ def load_authors_by(_, _info, by, limit, offset):
if order in ['likes', 'shouts', 'followers']: if order in ['likes', 'shouts', 'followers']:
q = q.order_by(desc(text(f'{order}_stat'))) q = q.order_by(desc(text(f'{order}_stat')))
q = q.distinct()
q = q.limit(limit).offset(offset) q = q.limit(limit).offset(offset)
authors = get_with_stat(q) authors = get_with_stat(q)

View File

@ -454,7 +454,9 @@ async def load_shouts_random_top(_, _info, options):
limit = options.get('limit', 10) limit = options.get('limit', 10)
q = q.group_by(Shout.id).order_by(func.random()).limit(limit) q = q.group_by(Shout.id).order_by(func.random()).limit(limit)
return await get_shouts_from_query(q) shouts = await get_shouts_from_query(q)
return shouts
@query.field('load_shouts_random_topic') @query.field('load_shouts_random_topic')