Commit 128846f6 by Oleg Marshev

BLD-449: Fix rearrange bug in problems.

parent 3859baa7
...@@ -5,6 +5,9 @@ These are notable changes in edx-platform. This is a rolling list of changes, ...@@ -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 in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected. 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 LMS: Beta instructor dashboard will only count actively enrolled students for
course enrollment numbers. course enrollment numbers.
......
...@@ -52,6 +52,7 @@ from chem import chemcalc ...@@ -52,6 +52,7 @@ from chem import chemcalc
from calc.preview import latex_preview from calc.preview import latex_preview
import xqueue_interface import xqueue_interface
from datetime import datetime from datetime import datetime
from xmodule.stringify import stringify_children
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
...@@ -406,13 +407,7 @@ class ChoiceGroup(InputTypeBase): ...@@ -406,13 +407,7 @@ class ChoiceGroup(InputTypeBase):
raise Exception( raise Exception(
"[capa.inputtypes.extract_choices] Expected a <choice> tag; got %s instead" "[capa.inputtypes.extract_choices] Expected a <choice> tag; got %s instead"
% choice.tag) % choice.tag)
choice_text = ''.join([etree.tostring(x) for x in choice]) choices.append((choice.get("name"), stringify_children(choice)))
if choice.text is not None:
# TODO: fix order?
choice_text += choice.text
choices.append((choice.get("name"), choice_text))
return choices return choices
......
...@@ -92,6 +92,7 @@ class ChoiceGroupTest(unittest.TestCase): ...@@ -92,6 +92,7 @@ class ChoiceGroupTest(unittest.TestCase):
<choice correct="false" name="foil1"><text>This is foil One.</text></choice> <choice correct="false" name="foil1"><text>This is foil One.</text></choice>
<choice correct="false" name="foil2"><text>This is foil Two.</text></choice> <choice correct="false" name="foil2"><text>This is foil Two.</text></choice>
<choice correct="true" name="foil3">This is foil Three.</choice> <choice correct="true" name="foil3">This is foil Three.</choice>
<choice correct="false" name="foil4">This is <b>foil</b> Four.</choice>
</{tag}> </{tag}>
""".format(tag=tag) """.format(tag=tag)
...@@ -114,7 +115,8 @@ class ChoiceGroupTest(unittest.TestCase): ...@@ -114,7 +115,8 @@ class ChoiceGroupTest(unittest.TestCase):
'input_type': expected_input_type, 'input_type': expected_input_type,
'choices': [('foil1', '<text>This is foil One.</text>'), 'choices': [('foil1', '<text>This is foil One.</text>'),
('foil2', '<text>This is foil Two.</text>'), ('foil2', '<text>This is foil Two.</text>'),
('foil3', 'This is foil Three.'), ], ('foil3', 'This is foil Three.'),
('foil4', 'This is <b>foil</b> Four.'), ],
'show_correctness': 'always', 'show_correctness': 'always',
'submitted_message': 'Answer received.', 'submitted_message': 'Answer received.',
'name_array_suffix': expected_suffix, # what is this for?? 'name_array_suffix': expected_suffix, # what is this for??
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment