diff --git a/main.py b/main.py index 4ebc0ad..938f4ba 100644 --- a/main.py +++ b/main.py @@ -78,9 +78,12 @@ def set_probability(message: Message): bot.send_message(message.chat.id, "В этом чате я пока никому не парировал") return text = "Вот кому я парировал:\n" - total = mongo.counter_collection.count_documents({"chat_id": message.chat.id}) - for index, value in enumerate(rating): - text += f"{index + 1}. @{value['username']} - {value['count']} ({int(value['count'] / total * 100)})%\n" + rating_arr = list(enumerate(rating)) + total = 0 + for _, value in rating_arr: + total += value['count'] + for index, value in rating_arr: + text += f"{index + 1}. @{value['username']} - {value['count']} ({int(value['count'] / total * 100)}%)\n" bot.send_message(message.chat.id, text)