From 56f95327615415e7c1af40d5c888f92b11375241 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 3 Sep 2019 19:16:41 +0200 Subject: [PATCH] Don't shuffle boolean questions --- royalnet/commands/royalgames/trivia.py | 10 +++++++--- royalnet/version.py | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/royalnet/commands/royalgames/trivia.py b/royalnet/commands/royalgames/trivia.py index 5dd2815c..d23a6bde 100644 --- a/royalnet/commands/royalgames/trivia.py +++ b/royalnet/commands/royalgames/trivia.py @@ -46,9 +46,13 @@ class TriviaCommand(Command): # Prepare answers correct_answer: str = question["correct_answer"] wrong_answers: typing.List[str] = question["incorrect_answers"] - answers = [correct_answer, *wrong_answers] - if question["type"] == "multiple" - random.shuffle(answers) + answers: typing.List[str] = [correct_answer, *wrong_answers] + if question["type"] == "multiple": + random.shuffle(answers) + elif question["type"] == "boolean": + answers.sort(key=lambda a: a) + else: + raise NotImplementedError("Unknown question type") # Find the correct index for index, answer in enumerate(answers): if answer == correct_answer: diff --git a/royalnet/version.py b/royalnet/version.py index 98fdd50e..c8d939ed 100644 --- a/royalnet/version.py +++ b/royalnet/version.py @@ -1 +1 @@ -semantic = "5.0a45" +semantic = "5.0a46"