This commit is contained in:
parent
d9d2e5e954
commit
4fb581de2d
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user