1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Don't shuffle boolean questions

This commit is contained in:
Steffo 2019-09-03 19:16:41 +02:00
parent 170b8caf2d
commit 56f9532761
2 changed files with 8 additions and 4 deletions

View file

@ -46,9 +46,13 @@ class TriviaCommand(Command):
# Prepare answers # Prepare answers
correct_answer: str = question["correct_answer"] correct_answer: str = question["correct_answer"]
wrong_answers: typing.List[str] = question["incorrect_answers"] wrong_answers: typing.List[str] = question["incorrect_answers"]
answers = [correct_answer, *wrong_answers] answers: typing.List[str] = [correct_answer, *wrong_answers]
if question["type"] == "multiple" if question["type"] == "multiple":
random.shuffle(answers) random.shuffle(answers)
elif question["type"] == "boolean":
answers.sort(key=lambda a: a)
else:
raise NotImplementedError("Unknown question type")
# Find the correct index # Find the correct index
for index, answer in enumerate(answers): for index, answer in enumerate(answers):
if answer == correct_answer: if answer == correct_answer:

View file

@ -1 +1 @@
semantic = "5.0a45" semantic = "5.0a46"