Commit 8b597964 by Calen Pennington Committed by Don Mitchell

Change default rerandomize and showanswer

The defaults used to be rerandomize=always, showanswer=closed. This is
preserved for capa problems being imported from XML. However, for
courses, and for problems created in Studio, the default has been
changed to never/finished, to match the previous defaults used by
Studio.
parent 3722685e
...@@ -33,12 +33,11 @@ def i_edit_and_select_settings(step): ...@@ -33,12 +33,11 @@ def i_edit_and_select_settings(step):
def i_see_five_settings_with_values(step): def i_see_five_settings_with_values(step):
world.verify_all_setting_entries( world.verify_all_setting_entries(
[ [
[DISPLAY_NAME, "New problem", True], [DISPLAY_NAME, "Blank Common Problem", True],
[MAXIMUM_ATTEMPTS, "", False], [MAXIMUM_ATTEMPTS, "", False],
[PROBLEM_WEIGHT, "", False], [PROBLEM_WEIGHT, "", False],
# Not sure why these are True other than via inspection [RANDOMIZATION, "Never", False],
[RANDOMIZATION, "Always", True], [SHOW_ANSWER, "Finished", False]
[SHOW_ANSWER, "Closed", True]
]) ])
...@@ -96,7 +95,7 @@ def my_change_to_randomization_is_persisted(step): ...@@ -96,7 +95,7 @@ def my_change_to_randomization_is_persisted(step):
def i_can_revert_to_default_for_randomization(step): def i_can_revert_to_default_for_randomization(step):
world.revert_setting_entry(RANDOMIZATION) world.revert_setting_entry(RANDOMIZATION)
world.save_component_and_reopen(step) 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 "(.*)"?') @step('I can set the weight to "(.*)"?')
......
...@@ -351,7 +351,7 @@ class CourseMetadataEditingTest(CourseTestCase): ...@@ -351,7 +351,7 @@ class CourseMetadataEditingTest(CourseTestCase):
self.assertEqual(test_model['display_name'], 'Robot Super Course', "not expected value") self.assertEqual(test_model['display_name'], 'Robot Super Course', "not expected value")
self.assertIn('rerandomize', test_model, 'Missing rerandomize metadata field') self.assertIn('rerandomize', test_model, 'Missing rerandomize metadata field')
# check for deletion effectiveness # 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') self.assertEqual(None, test_model['xqa_key'], 'xqa_key field still in')
......
...@@ -103,7 +103,7 @@ class CapaFields(object): ...@@ -103,7 +103,7 @@ class CapaFields(object):
help=("Defines when to show the answer to the problem. " help=("Defines when to show the answer to the problem. "
"A default value can be set in Advanced Settings."), "A default value can be set in Advanced Settings."),
scope=Scope.settings, scope=Scope.settings,
default="closed", default="finished",
values=[ values=[
{"display_name": "Always", "value": "always"}, {"display_name": "Always", "value": "always"},
{"display_name": "Answered", "value": "answered"}, {"display_name": "Answered", "value": "answered"},
...@@ -123,7 +123,7 @@ class CapaFields(object): ...@@ -123,7 +123,7 @@ class CapaFields(object):
help="Defines how often inputs are randomized when a student loads the problem. " 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. " "This setting only applies to problems that can have randomly generated numeric values. "
"A default value can be set in Advanced Settings.", "A default value can be set in Advanced Settings.",
default="always", default="never",
scope=Scope.settings, scope=Scope.settings,
values=[ values=[
{"display_name": "Always", "value": "always"}, {"display_name": "Always", "value": "always"},
...@@ -1112,6 +1112,20 @@ class CapaDescriptor(CapaFields, RawDescriptor): ...@@ -1112,6 +1112,20 @@ class CapaDescriptor(CapaFields, RawDescriptor):
path[8:], 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 @property
def non_editable_metadata_fields(self): def non_editable_metadata_fields(self):
non_editable_fields = super(CapaDescriptor, self).non_editable_metadata_fields non_editable_fields = super(CapaDescriptor, self).non_editable_metadata_fields
......
--- ---
metadata: metadata:
display_name: Circuit Schematic Builder display_name: Circuit Schematic Builder
rerandomize: never
showanswer: finished
markdown: !!null markdown: !!null
data: | data: |
<problem > <problem >
......
--- ---
metadata: metadata:
display_name: Math Expression Input display_name: Math Expression Input
rerandomize: never
showanswer: finished
markdown: !!null markdown: !!null
data: | data: |
<problem> <problem>
......
--- ---
metadata: metadata:
display_name: Image Mapped Input display_name: Image Mapped Input
rerandomize: never
showanswer: finished
markdown: !!null markdown: !!null
data: | data: |
<problem> <problem>
......
--- ---
metadata: metadata:
display_name: Multiple Choice display_name: Multiple Choice
rerandomize: never
showanswer: finished
markdown: | markdown: |
A multiple choice problem presents radio buttons for student input. Students can only select a single 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 option presented. Multiple Choice questions have been the subject of many areas of research due to the early
......
--- ---
metadata: metadata:
display_name: Numerical Input display_name: Numerical Input
rerandomize: never
showanswer: finished
markdown: | markdown: |
A numerical input problem accepts a line of text input from the A numerical input problem accepts a line of text input from the
student, and evaluates the input for correctness based on its student, and evaluates the input for correctness based on its
......
--- ---
metadata: metadata:
display_name: Dropdown display_name: Dropdown
rerandomize: never
showanswer: finished
markdown: | markdown: |
Dropdown problems give a limited set of options for students to respond with, and present those options 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 in a format that encourages them to search for a specific answer rather than being immediately presented
......
--- ---
metadata: metadata:
display_name: Text Input display_name: Text Input
rerandomize: never
showanswer: finished
markdown: | markdown: |
A text input problem accepts a line of text from the A text input problem accepts a line of text from the
student, and evaluates the input for correctness based on an expected student, and evaluates the input for correctness based on an expected
......
...@@ -636,10 +636,10 @@ class CapaModuleTest(unittest.TestCase): ...@@ -636,10 +636,10 @@ class CapaModuleTest(unittest.TestCase):
# Expect that the problem was reset # Expect that the problem was reset
module.new_lcp.assert_called_once_with(None) module.new_lcp.assert_called_once_with(None)
module.choose_new_seed.assert_called_once_with()
def test_reset_problem_closed(self): def test_reset_problem_closed(self):
module = CapaFactory.create() # pre studio default
module = CapaFactory.create(rerandomize="always")
# Simulate that the problem is closed # Simulate that the problem is closed
with patch('xmodule.capa_module.CapaModule.closed') as mock_closed: with patch('xmodule.capa_module.CapaModule.closed') as mock_closed:
...@@ -900,13 +900,13 @@ class CapaModuleTest(unittest.TestCase): ...@@ -900,13 +900,13 @@ class CapaModuleTest(unittest.TestCase):
module = CapaFactory.create(done=False) module = CapaFactory.create(done=False)
self.assertFalse(module.should_show_reset_button()) self.assertFalse(module.should_show_reset_button())
# Otherwise, DO show the reset button # pre studio default value, DO show the reset button
module = CapaFactory.create(done=True) module = CapaFactory.create(rerandomize="always", done=True)
self.assertTrue(module.should_show_reset_button()) self.assertTrue(module.should_show_reset_button())
# If survey question for capa (max_attempts = 0), # If survey question for capa (max_attempts = 0),
# DO show the reset button # 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()) self.assertTrue(module.should_show_reset_button())
def test_should_show_save_button(self): def test_should_show_save_button(self):
...@@ -940,8 +940,8 @@ class CapaModuleTest(unittest.TestCase): ...@@ -940,8 +940,8 @@ class CapaModuleTest(unittest.TestCase):
module = CapaFactory.create(max_attempts=None, rerandomize="per_student", done=True) module = CapaFactory.create(max_attempts=None, rerandomize="per_student", done=True)
self.assertFalse(module.should_show_save_button()) self.assertFalse(module.should_show_save_button())
# Otherwise, DO show the save button # pre-studio default, DO show the save button
module = CapaFactory.create(done=False) module = CapaFactory.create(rerandomize="always", done=False)
self.assertTrue(module.should_show_save_button()) self.assertTrue(module.should_show_save_button())
# If we're not randomizing and we have limited attempts, then we can save # If we're not randomizing and we have limited attempts, then we can save
......
...@@ -41,8 +41,16 @@ class LmsNamespace(Namespace): ...@@ -41,8 +41,16 @@ class LmsNamespace(Namespace):
help="Amount of time after the due date that submissions will be accepted", help="Amount of time after the due date that submissions will be accepted",
scope=Scope.settings scope=Scope.settings
) )
showanswer = String(help="When to show the problem answer to the student", scope=Scope.settings, default="closed") showanswer = String(
rerandomize = String(help="When to rerandomize the problem", default="always", scope=Scope.settings) 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( days_early_for_beta = Float(
help="Number of days early to show content to beta users", help="Number of days early to show content to beta users",
default=None, default=None,
......
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