diff --git a/common/lib/capa/capa/templates/annotationinput.html b/common/lib/capa/capa/templates/annotationinput.html index 18d2e03bd1..3e20c975a3 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 2ba76dabcc..bcad73897a 100644 --- a/common/lib/capa/capa/templates/choicegroup.html +++ b/common/lib/capa/capa/templates/choicegroup.html @@ -6,8 +6,7 @@ not isinstance(value, basestring) and choice_id in value )) %> - -
+
% if response_data['label']: ${response_data['label']} @@ -72,4 +71,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 2f8111d454..0199a2f8d0 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 85446e4dfa..b4d007e4d8 100644 --- a/common/lib/capa/capa/templates/javascriptinput.html +++ b/common/lib/capa/capa/templates/javascriptinput.html @@ -1,9 +1,10 @@ -
+
-
-
+ + diff --git a/common/lib/capa/capa/templates/optioninput.html b/common/lib/capa/capa/templates/optioninput.html index 3a4f2d9987..f32544145b 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 713b0a05b6..e49881b6f9 100644 --- a/common/lib/xmodule/xmodule/capa_base.py +++ b/common/lib/xmodule/xmodule/capa_base.py @@ -1288,16 +1288,17 @@ class CapaMixin(CapaFields): if is_correct is None: is_correct = '' - response_data = getattr(answer_input, 'response_data', {}) input_metadata[input_id] = { - 'question': response_data.get('label', ''), + 'question': answer_input.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 8d7fc00f88..84c3125e55 100644 --- a/common/lib/xmodule/xmodule/tests/test_capa_module.py +++ b/common/lib/xmodule/xmodule/tests/test_capa_module.py @@ -2600,7 +2600,6 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'optionresponse', 'input_type': 'optioninput', 'correct': True, - 'group_label': '', 'variant': '', }, factory.answer_key(3): { @@ -2609,7 +2608,6 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'multiplechoiceresponse', 'input_type': 'choicegroup', 'correct': False, - 'group_label': '', 'variant': '', }, factory.answer_key(4): { @@ -2618,7 +2616,6 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'choiceresponse', 'input_type': 'checkboxgroup', 'correct': False, - 'group_label': '', 'variant': '', }, }) @@ -2659,7 +2656,6 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'numericalresponse', 'input_type': 'textline', 'correct': True, - 'group_label': '', 'variant': '', } }) @@ -2791,7 +2787,6 @@ class TestProblemCheckTracking(unittest.TestCase): 'response_type': 'numericalresponse', 'input_type': 'textline', 'correct': True, - 'group_label': '', 'variant': module.seed, } }) @@ -2824,13 +2819,11 @@ 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 9342f19953..ffb0046d1e 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 21f340f4dd..1b912ad821 100644 --- a/lms/templates/problem.html +++ b/lms/templates/problem.html @@ -12,8 +12,6 @@ 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']) }
@@ -41,5 +39,4 @@ from openedx.core.djangolib.markup import HTML
% endif
-