From 2061fc7680fd7e4013b71ef16033088d2196fc13 Mon Sep 17 00:00:00 2001 From: Nate Bowman Date: Wed, 15 Mar 2017 13:11:12 -0500 Subject: [PATCH 1/2] Remove message from MultipleChoice when no ALWAYS_CORRECT present (#294) --- course/page/choice.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/course/page/choice.py b/course/page/choice.py index 0324745b..2d5f536b 100644 --- a/course/page/choice.py +++ b/course/page/choice.py @@ -572,13 +572,15 @@ class MultipleChoiceQuestion(ChoiceQuestionBase): corr_idx_list = self.unpermuted_correct_indices() always_correct_idx_list = self.unpermuted_always_correct_indices() - result = (string_concat( - string_concat(_("The correct answer is"), ": %s.") - % self.get_answer_html(page_context, corr_idx_list), - string_concat(_("Additional acceptable options are"), - ": %s.") - % self.get_answer_html(page_context, - always_correct_idx_list))) + result = (string_concat(_("The correct answer is"), ": %s") + % self.get_answer_html(page_context, corr_idx_list)) + + if len(always_correct_idx_list) == 0: + result = (string_concat(result, + string_concat(_("Additional acceptable options are"), + ": %s") + % self.get_answer_html(page_context, + always_correct_idx_list))) if hasattr(self.page_desc, "answer_explanation"): result += markup_to_html(page_context, self.page_desc.answer_explanation) -- GitLab From b00622db75134129bec9dcf647c24d6dbb14b6fa Mon Sep 17 00:00:00 2001 From: Nate Bowman Date: Thu, 16 Mar 2017 08:21:21 -0500 Subject: [PATCH 2/2] Fix test for when to add acceptable options message (#294) --- course/page/choice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/course/page/choice.py b/course/page/choice.py index 2d5f536b..b59669c8 100644 --- a/course/page/choice.py +++ b/course/page/choice.py @@ -575,7 +575,7 @@ class MultipleChoiceQuestion(ChoiceQuestionBase): result = (string_concat(_("The correct answer is"), ": %s") % self.get_answer_html(page_context, corr_idx_list)) - if len(always_correct_idx_list) == 0: + if len(always_correct_idx_list) > 0: result = (string_concat(result, string_concat(_("Additional acceptable options are"), ": %s") -- GitLab