unrated-fix
All checks were successful
Deploy on push / deploy (push) Successful in 6s

This commit is contained in:
Untone 2024-11-14 00:26:12 +03:00
parent af2d8caebe
commit cd90e7a2d0

View File

@ -441,16 +441,10 @@ async def load_shouts_unrated(_, info, options):
.scalar_subquery()
)
# add topic inside output data in main_topic field
aliased_topic = aliased(Topic)
q = (
select(Shout)
.join(aliased_topic, aliased_topic.id == Shout.main_topic.id)
.where(and_(Shout.published_at.is_not(None), Shout.deleted_at.is_(None), ~Shout.id.in_(rated_shouts)))
# .order_by(desc(Shout.published_at))
.order_by(func.random())
)
q = query_with_stat(info)
q = q.where(~Shout.id.in_(rated_shouts))
q = q.order_by(func.random())
limit = options.get("limit", 5)
offset = options.get("offset", 0)
return get_shouts_with_links(info, q, limit, offset)