diff options
author | 2022-01-09 18:10:59 -0500 | |
---|---|---|
committer | 2022-02-09 18:13:37 -0500 | |
commit | e7163dd5dd23ecc75d8b628262733510abf9d0d6 (patch) | |
tree | 1640e59c7158afca5870fcd52833868960d764bd | |
parent | preventing the number of points from reaching too high (diff) |
use correct emoji name for .tn list
-rw-r--r-- | bot/exts/events/trivianight/_game.py | 2 | ||||
-rw-r--r-- | bot/exts/events/trivianight/_questions.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/bot/exts/events/trivianight/_game.py b/bot/exts/events/trivianight/_game.py index 0b5fe562..9d8b98c1 100644 --- a/bot/exts/events/trivianight/_game.py +++ b/bot/exts/events/trivianight/_game.py @@ -175,7 +175,7 @@ class TriviaNightGame: spaces = max(len(q.description) for q in self._all_questions) for question in self._all_questions: - visited, not_visited = ":checkmark:", ":x:" + visited, not_visited = ":white_check_mark:", ":x:" formatted_string += f"`Q{question.number}: {question.description}" \ f"{' ' * (spaces - len(question.description))}|`" \ f" {visited if question not in self._questions else not_visited}\n" diff --git a/bot/exts/events/trivianight/_questions.py b/bot/exts/events/trivianight/_questions.py index d729009d..391e0a9e 100644 --- a/bot/exts/events/trivianight/_questions.py +++ b/bot/exts/events/trivianight/_questions.py @@ -128,7 +128,7 @@ class QuestionView(View): answers_chosen = { answer_choice: len( tuple(filter(lambda x: x[0] == answer_choice, guesses.values())) - ) / len(guesses) + ) for answer_choice in labels } @@ -136,16 +136,16 @@ class QuestionView(View): sorted(list(answers_chosen.items()), key=lambda item: item[1], reverse=True) ) - for answer, percent in answers_chosen.items(): + for answer, people_answered in answers_chosen.items(): # Setting the color of answer_embed to the % of people that got it correct via the mapping if dict(self.question.answers)[answer[0]] == self.question.correct: # Maps the % of people who got it right to a color, from a range of red to green percentage_to_color = [0xFC94A1, 0xFFCCCB, 0xCDFFCC, 0xB0F5AB, 0xB0F5AB] - answer_embed.color = percentage_to_color[round(percent * 100) // 25] + answer_embed.color = percentage_to_color[round(people_answered / len(guesses) * 100) // 25] # The `ord` function is used here to change the letter to its corresponding position answer_embed.add_field( - name=f"{percent * 100:.1f}% of players chose", + name=f"{people_answered / len(guesses) * 100:.1f}% of players chose", value=self.question.answers[ord(answer) - 65][1], inline=False ) |