filter fix

This commit is contained in:
tonyrewin 2022-09-05 15:41:12 +03:00
parent ef6adbb4ea
commit 114b2d8b0f

View File

@ -89,8 +89,8 @@ async def topics_random(_, info):
topics = await TopicStorage.get_topics_all(1, 700)
normalized_topics = []
for topic in topics:
shouts_amount = await TopicStat.get_stat(topic.slug)
topic.stat = shouts_amount
if shouts_amount > 2:
topic_stat = await TopicStat.get_stat(topic.slug)
topic.stat = topic_stat
if topic_stat["shouts"] > 2:
normalized_topics.push(topic)
return random.choices(topics)[0:12]