diff --git a/cms/djangoapps/contentstore/features/problem-editor.py b/cms/djangoapps/contentstore/features/problem-editor.py index 99b693225d..64b2ec9b5c 100644 --- a/cms/djangoapps/contentstore/features/problem-editor.py +++ b/cms/djangoapps/contentstore/features/problem-editor.py @@ -33,12 +33,11 @@ def i_edit_and_select_settings(step): def i_see_five_settings_with_values(step): world.verify_all_setting_entries( [ - [DISPLAY_NAME, "New problem", True], + [DISPLAY_NAME, "Blank Common Problem", True], [MAXIMUM_ATTEMPTS, "", False], [PROBLEM_WEIGHT, "", False], - # Not sure why these are True other than via inspection - [RANDOMIZATION, "Always", True], - [SHOW_ANSWER, "Closed", True] + [RANDOMIZATION, "Never", False], + [SHOW_ANSWER, "Finished", False] ]) @@ -96,7 +95,7 @@ def my_change_to_randomization_is_persisted(step): def i_can_revert_to_default_for_randomization(step): world.revert_setting_entry(RANDOMIZATION) world.save_component_and_reopen(step) - world.verify_setting_entry(world.get_setting_entry(RANDOMIZATION), RANDOMIZATION, "Always", False) + world.verify_setting_entry(world.get_setting_entry(RANDOMIZATION), RANDOMIZATION, "Never", False) @step('I can set the weight to "(.*)"?') diff --git a/cms/djangoapps/contentstore/tests/test_course_settings.py b/cms/djangoapps/contentstore/tests/test_course_settings.py index fc04ad0a58..44eb16436d 100644 --- a/cms/djangoapps/contentstore/tests/test_course_settings.py +++ b/cms/djangoapps/contentstore/tests/test_course_settings.py @@ -351,7 +351,7 @@ class CourseMetadataEditingTest(CourseTestCase): self.assertEqual(test_model['display_name'], 'Robot Super Course', "not expected value") self.assertIn('rerandomize', test_model, 'Missing rerandomize metadata field') # check for deletion effectiveness - self.assertEqual('closed', test_model['showanswer'], 'showanswer field still in') + self.assertEqual('finished', test_model['showanswer'], 'showanswer field still in') self.assertEqual(None, test_model['xqa_key'], 'xqa_key field still in') diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 752f0d3362..40c69e9169 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -103,7 +103,7 @@ class CapaFields(object): help=("Defines when to show the answer to the problem. " "A default value can be set in Advanced Settings."), scope=Scope.settings, - default="closed", + default="finished", values=[ {"display_name": "Always", "value": "always"}, {"display_name": "Answered", "value": "answered"}, @@ -123,7 +123,7 @@ class CapaFields(object): help="Defines how often inputs are randomized when a student loads the problem. " "This setting only applies to problems that can have randomly generated numeric values. " "A default value can be set in Advanced Settings.", - default="always", + default="never", scope=Scope.settings, values=[ {"display_name": "Always", "value": "always"}, @@ -1112,6 +1112,20 @@ class CapaDescriptor(CapaFields, RawDescriptor): path[8:], ] + @classmethod + def from_xml(cls, xml_data, system, org=None, course=None): + """ + Augment regular translation w/ setting the pre-Studio defaults. + """ + problem = super(CapaDescriptor, cls).from_xml(xml_data, system, org, course) + # pylint: disable=W0212 + if 'showanswer' not in problem._model_data: + problem.showanswer = "closed" + if 'rerandomize' not in problem._model_data: + problem.rerandomize = "always" + return problem + + @property def non_editable_metadata_fields(self): non_editable_fields = super(CapaDescriptor, self).non_editable_metadata_fields diff --git a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml index 1717bb91ad..051dfe1912 100644 --- a/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/circuitschematic.yaml @@ -1,8 +1,6 @@ --- metadata: display_name: Circuit Schematic Builder - rerandomize: never - showanswer: finished markdown: !!null data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml index 4cf877bd1f..807a7833e4 100644 --- a/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/forumularesponse.yaml @@ -1,8 +1,6 @@ --- metadata: display_name: Math Expression Input - rerandomize: never - showanswer: finished markdown: !!null data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml index 566997671d..44bcc56d80 100644 --- a/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/imageresponse.yaml @@ -1,8 +1,6 @@ --- metadata: display_name: Image Mapped Input - rerandomize: never - showanswer: finished markdown: !!null data: | diff --git a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml index 202fc03b44..68845564d5 100644 --- a/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/multiplechoice.yaml @@ -1,8 +1,6 @@ --- metadata: display_name: Multiple Choice - rerandomize: never - showanswer: finished markdown: | A multiple choice problem presents radio buttons for student input. Students can only select a single option presented. Multiple Choice questions have been the subject of many areas of research due to the early diff --git a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml index 9b2ddec2a7..e97a54b460 100644 --- a/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/numericalresponse.yaml @@ -1,8 +1,6 @@ --- metadata: display_name: Numerical Input - rerandomize: never - showanswer: finished markdown: | A numerical input problem accepts a line of text input from the student, and evaluates the input for correctness based on its diff --git a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml index 8e59f8ae4d..44af7a850a 100644 --- a/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/optionresponse.yaml @@ -1,8 +1,6 @@ --- metadata: display_name: Dropdown - rerandomize: never - showanswer: finished markdown: | Dropdown problems give a limited set of options for students to respond with, and present those options in a format that encourages them to search for a specific answer rather than being immediately presented diff --git a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml index 9c59ae3bc2..cf95fe8331 100644 --- a/common/lib/xmodule/xmodule/templates/problem/string_response.yaml +++ b/common/lib/xmodule/xmodule/templates/problem/string_response.yaml @@ -1,8 +1,6 @@ --- metadata: display_name: Text Input - rerandomize: never - showanswer: finished markdown: | A text input problem accepts a line of text from the student, and evaluates the input for correctness based on an expected diff --git a/common/lib/xmodule/xmodule/tests/test_capa_module.py b/common/lib/xmodule/xmodule/tests/test_capa_module.py index 1e84174291..0f3dfa5b85 100644 --- a/common/lib/xmodule/xmodule/tests/test_capa_module.py +++ b/common/lib/xmodule/xmodule/tests/test_capa_module.py @@ -636,10 +636,10 @@ class CapaModuleTest(unittest.TestCase): # Expect that the problem was reset module.new_lcp.assert_called_once_with(None) - module.choose_new_seed.assert_called_once_with() def test_reset_problem_closed(self): - module = CapaFactory.create() + # pre studio default + module = CapaFactory.create(rerandomize="always") # Simulate that the problem is closed with patch('xmodule.capa_module.CapaModule.closed') as mock_closed: @@ -900,13 +900,13 @@ class CapaModuleTest(unittest.TestCase): module = CapaFactory.create(done=False) self.assertFalse(module.should_show_reset_button()) - # Otherwise, DO show the reset button - module = CapaFactory.create(done=True) + # pre studio default value, DO show the reset button + module = CapaFactory.create(rerandomize="always", done=True) self.assertTrue(module.should_show_reset_button()) # If survey question for capa (max_attempts = 0), # DO show the reset button - module = CapaFactory.create(max_attempts=0, done=True) + module = CapaFactory.create(rerandomize="always", max_attempts=0, done=True) self.assertTrue(module.should_show_reset_button()) def test_should_show_save_button(self): @@ -940,8 +940,8 @@ class CapaModuleTest(unittest.TestCase): module = CapaFactory.create(max_attempts=None, rerandomize="per_student", done=True) self.assertFalse(module.should_show_save_button()) - # Otherwise, DO show the save button - module = CapaFactory.create(done=False) + # pre-studio default, DO show the save button + module = CapaFactory.create(rerandomize="always", done=False) self.assertTrue(module.should_show_save_button()) # If we're not randomizing and we have limited attempts, then we can save diff --git a/lms/xmodule_namespace.py b/lms/xmodule_namespace.py index a78e27e5af..d57ad9ce52 100644 --- a/lms/xmodule_namespace.py +++ b/lms/xmodule_namespace.py @@ -41,8 +41,16 @@ class LmsNamespace(Namespace): help="Amount of time after the due date that submissions will be accepted", scope=Scope.settings ) - showanswer = String(help="When to show the problem answer to the student", scope=Scope.settings, default="closed") - rerandomize = String(help="When to rerandomize the problem", default="always", scope=Scope.settings) + showanswer = String( + help="When to show the problem answer to the student", + scope=Scope.settings, + default="finished" + ) + rerandomize = String( + help="When to rerandomize the problem", + default="never", + scope=Scope.settings + ) days_early_for_beta = Float( help="Number of days early to show content to beta users", default=None,