From 128846f67d21cf41514b71aab68336f977221f3c Mon Sep 17 00:00:00 2001 From: Oleg Marshev Date: Thu, 7 Nov 2013 10:34:42 +0200 Subject: [PATCH] BLD-449: Fix rearrange bug in problems. --- CHANGELOG.rst | 3 +++ common/lib/capa/capa/inputtypes.py | 9 ++------- common/lib/capa/capa/tests/test_inputtypes.py | 4 +++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 5c025cb433..2a6b19afa8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,9 @@ These are notable changes in edx-platform. This is a rolling list of changes, in roughly chronological order, most recent first. Add your entries at or near the top. Include a label indicating the component affected. +Blades: Fix answer choices rearranging if user tries to stylize something in the +text like with bold or italics. (BLD-449) + LMS: Beta instructor dashboard will only count actively enrolled students for course enrollment numbers. diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py index 8a2ff099a1..79fde4f6ae 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -52,6 +52,7 @@ from chem import chemcalc from calc.preview import latex_preview import xqueue_interface from datetime import datetime +from xmodule.stringify import stringify_children log = logging.getLogger(__name__) @@ -406,13 +407,7 @@ class ChoiceGroup(InputTypeBase): raise Exception( "[capa.inputtypes.extract_choices] Expected a tag; got %s instead" % choice.tag) - choice_text = ''.join([etree.tostring(x) for x in choice]) - if choice.text is not None: - # TODO: fix order? - choice_text += choice.text - - choices.append((choice.get("name"), choice_text)) - + choices.append((choice.get("name"), stringify_children(choice))) return choices diff --git a/common/lib/capa/capa/tests/test_inputtypes.py b/common/lib/capa/capa/tests/test_inputtypes.py index 0efd84f8cb..6d7a8e1ce9 100644 --- a/common/lib/capa/capa/tests/test_inputtypes.py +++ b/common/lib/capa/capa/tests/test_inputtypes.py @@ -92,6 +92,7 @@ class ChoiceGroupTest(unittest.TestCase): This is foil One. This is foil Two. This is foil Three. + This is foil Four. """.format(tag=tag) @@ -114,7 +115,8 @@ class ChoiceGroupTest(unittest.TestCase): 'input_type': expected_input_type, 'choices': [('foil1', 'This is foil One.'), ('foil2', 'This is foil Two.'), - ('foil3', 'This is foil Three.'), ], + ('foil3', 'This is foil Three.'), + ('foil4', 'This is foil Four.'), ], 'show_correctness': 'always', 'submitted_message': 'Answer received.', 'name_array_suffix': expected_suffix, # what is this for??