random-topic-fix-2
All checks were successful
deploy / deploy (push) Successful in 1m23s

This commit is contained in:
Untone 2023-12-22 21:22:23 +03:00
parent d9d2e5e954
commit 4fb581de2d

View File

@ -195,7 +195,7 @@ def get_random_topic():
q = q.group_by(Topic.id) q = q.group_by(Topic.id)
q = q.having(func.count(distinct(ShoutTopic.shout)) > 10) q = q.having(func.count(distinct(ShoutTopic.shout)) > 10)
q = q.order_by(func.random()).limit(1) q = q.order_by(func.random()).limit(1)
topic = None
with local_session() as session: with local_session() as session:
[topic] = session.execute(q).all() [topic] = session.execute(q).first()
return topic return topic