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:
Calen Pennington
2013-07-10 13:32:00 -04:00
committed by Don Mitchell
parent 3722685e1a
commit 8b5979641b
12 changed files with 38 additions and 31 deletions

View File

@@ -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

View File

@@ -1,8 +1,6 @@
---
metadata:
display_name: Circuit Schematic Builder
rerandomize: never
showanswer: finished
markdown: !!null
data: |
<problem >

View File

@@ -1,8 +1,6 @@
---
metadata:
display_name: Math Expression Input
rerandomize: never
showanswer: finished
markdown: !!null
data: |
<problem>

View File

@@ -1,8 +1,6 @@
---
metadata:
display_name: Image Mapped Input
rerandomize: never
showanswer: finished
markdown: !!null
data: |
<problem>

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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