fix-random-sample

This commit is contained in:
tonyrewin 2022-09-07 09:57:53 +03:00
parent 7db7606da5
commit 37859dff6a

View File

@ -93,4 +93,4 @@ async def topics_random(_, info, amount=12):
topic.stat = topic_stat
if topic_stat["shouts"] > 2:
normalized_topics.push(topic)
return random.sample(normalized_topics, k=amount)
return random.sample(normalized_topics, k=max(len(normalized_topics), 12))