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.
This commit is contained in:
committed by
Don Mitchell
parent
3722685e1a
commit
8b5979641b
@@ -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 "(.*)"?')
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
---
|
||||
metadata:
|
||||
display_name: Circuit Schematic Builder
|
||||
rerandomize: never
|
||||
showanswer: finished
|
||||
markdown: !!null
|
||||
data: |
|
||||
<problem >
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
---
|
||||
metadata:
|
||||
display_name: Math Expression Input
|
||||
rerandomize: never
|
||||
showanswer: finished
|
||||
markdown: !!null
|
||||
data: |
|
||||
<problem>
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
---
|
||||
metadata:
|
||||
display_name: Image Mapped Input
|
||||
rerandomize: never
|
||||
showanswer: finished
|
||||
markdown: !!null
|
||||
data: |
|
||||
<problem>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user