diff --git a/common/lib/capa/capa/templates/annotationinput.html b/common/lib/capa/capa/templates/annotationinput.html index 3e20c975a3..18d2e03bd1 100644 --- a/common/lib/capa/capa/templates/annotationinput.html +++ b/common/lib/capa/capa/templates/annotationinput.html @@ -1,5 +1,5 @@ <%! from openedx.core.djangolib.markup import HTML %> -
+
@@ -57,7 +57,7 @@

- +
% if msg: ${HTML(msg)} diff --git a/common/lib/capa/capa/templates/choicegroup.html b/common/lib/capa/capa/templates/choicegroup.html index bcad73897a..2ba76dabcc 100644 --- a/common/lib/capa/capa/templates/choicegroup.html +++ b/common/lib/capa/capa/templates/choicegroup.html @@ -6,7 +6,8 @@ not isinstance(value, basestring) and choice_id in value )) %> -
+ +
% if response_data['label']: ${response_data['label']} @@ -71,4 +72,4 @@ % if msg: ${HTML(msg)} % endif - +
diff --git a/common/lib/capa/capa/templates/choicetext.html b/common/lib/capa/capa/templates/choicetext.html index 0199a2f8d0..2f8111d454 100644 --- a/common/lib/capa/capa/templates/choicetext.html +++ b/common/lib/capa/capa/templates/choicetext.html @@ -8,7 +8,7 @@ %endif % endfor
-
+
@@ -73,5 +73,5 @@ % if msg: ${msg|n} % endif - +
diff --git a/common/lib/capa/capa/templates/javascriptinput.html b/common/lib/capa/capa/templates/javascriptinput.html index b4d007e4d8..85446e4dfa 100644 --- a/common/lib/capa/capa/templates/javascriptinput.html +++ b/common/lib/capa/capa/templates/javascriptinput.html @@ -1,10 +1,9 @@ -
+
-
- - +
diff --git a/common/lib/capa/capa/templates/optioninput.html b/common/lib/capa/capa/templates/optioninput.html index f32544145b..3a4f2d9987 100644 --- a/common/lib/capa/capa/templates/optioninput.html +++ b/common/lib/capa/capa/templates/optioninput.html @@ -2,7 +2,7 @@ <%! from openedx.core.djangolib.markup import HTML %> <% doinline = "inline" if inline else "" %> -
+
% if response_data['label']: % endif @@ -31,4 +31,4 @@ % if msg: ${HTML(msg)} % endif - +
diff --git a/common/lib/xmodule/xmodule/capa_base.py b/common/lib/xmodule/xmodule/capa_base.py index e49881b6f9..713b0a05b6 100644 --- a/common/lib/xmodule/xmodule/capa_base.py +++ b/common/lib/xmodule/xmodule/capa_base.py @@ -1288,17 +1288,16 @@ class CapaMixin(CapaFields): if is_correct is None: is_correct = '' + response_data = getattr(answer_input, 'response_data', {}) input_metadata[input_id] = { - 'question': answer_input.response_data.get('label', ''), + 'question': response_data.get('label', ''), 'answer': user_visible_answer, 'response_type': getattr(getattr(answer_response, 'xml', None), 'tag', ''), 'input_type': getattr(answer_input, 'tag', ''), 'correct': is_correct, 'variant': variant, + 'group_label': response_data.get('group_label', ''), } - # Add group_label in event data only if the responsetype contains multiple inputtypes - if answer_input.response_data.get('group_label'): - input_metadata[input_id]['group_label'] = answer_input.response_data.get('group_label') return input_metadata diff --git a/common/lib/xmodule/xmodule/tests/test_capa_module.py b/common/lib/xmodule/xmodule/tests/test_capa_module.py index 84c3125e55..8d7fc00f88 100644 --- a/common/lib/xmodule/xmodule/tests/test_capa_module.py +++ b/common/lib/xmodule/xmodule/tests/test_capa_module.py @@ -2600,6 +2600,7 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'optionresponse', 'input_type': 'optioninput', 'correct': True, + 'group_label': '', 'variant': '', }, factory.answer_key(3): { @@ -2608,6 +2609,7 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'multiplechoiceresponse', 'input_type': 'choicegroup', 'correct': False, + 'group_label': '', 'variant': '', }, factory.answer_key(4): { @@ -2616,6 +2618,7 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'choiceresponse', 'input_type': 'checkboxgroup', 'correct': False, + 'group_label': '', 'variant': '', }, }) @@ -2656,6 +2659,7 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'numericalresponse', 'input_type': 'textline', 'correct': True, + 'group_label': '', 'variant': '', } }) @@ -2787,6 +2791,7 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'numericalresponse', 'input_type': 'textline', 'correct': True, + 'group_label': '', 'variant': module.seed, } }) @@ -2819,11 +2824,13 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'coderesponse', 'input_type': 'filesubmission', 'correct': False, + 'group_label': '', 'variant': '', }, factory.answer_key(3): { 'answer': 'None', 'correct': True, + 'group_label': '', 'question': '', 'response_type': 'customresponse', 'input_type': 'textline', diff --git a/lms/djangoapps/courseware/features/problems_setup.py b/lms/djangoapps/courseware/features/problems_setup.py index ffb0046d1e..9342f19953 100644 --- a/lms/djangoapps/courseware/features/problems_setup.py +++ b/lms/djangoapps/courseware/features/problems_setup.py @@ -216,7 +216,7 @@ def answer_problem(course, problem_type, correctness): world.css_fill(inputfield(course, 'string'), textvalue) elif problem_type == 'numerical': - textvalue = "pi + 1" if correctness == 'correct' else str(random.randint(-2, 2)) + textvalue = "pi+1" if correctness == 'correct' else str(random.randint(-2, 2)) world.css_fill(inputfield(course, 'numerical'), textvalue) elif problem_type == 'formula': diff --git a/lms/templates/problem.html b/lms/templates/problem.html index 1b912ad821..21f340f4dd 100644 --- a/lms/templates/problem.html +++ b/lms/templates/problem.html @@ -12,6 +12,8 @@ from openedx.core.djangolib.markup import HTML
+ ## onsubmit is required because click on any button inside form will submit it and reload page which we don't want +
${ HTML(problem['html']) }
@@ -39,4 +41,5 @@ from openedx.core.djangolib.markup import HTML
% endif
+