Commit 35408b8c by Justin Riley

move suspended problems list to advanced settings

Moved the list of suspended problems to advanced settings (ie
policy.json) instead of defining them in the <randomize> tag within the
course xml. This avoids potentially destroying student state and makes
it easier for course admins to add/remove suspended problems. Course
admins can now define *all* suspended problems in one place simply by
listing them in the 'Advanced Settings' page of the studio web
interface.
parent 309fb413
......@@ -5,7 +5,7 @@ Support for inheritance of fields down an XBlock hierarchy.
from datetime import datetime
from pytz import UTC
from xblock.fields import Scope, Boolean, String, Float, XBlockMixin, Dict, Integer
from xblock.fields import Scope, Boolean, String, Float, XBlockMixin, Dict, Integer, List
from xblock.runtime import KeyValueStore, KvsFieldData
from xmodule.fields import Date, Timedelta
......@@ -86,6 +86,11 @@ class InheritanceMixin(XBlockMixin):
"If the value is not set, infinite attempts are allowed."),
values={"min": 0}, scope=Scope.settings
)
suspended = List(
help="A list of problem url_name's to exclude from the list of "
"choices in the randomize XModule",
scope=Scope.settings
)
proctor_url = String(
help="URL of proctor server",
scope=Scope.settings
......
......@@ -18,6 +18,7 @@ class RandomizeFields(object):
choice = String(help="Which random child was chosen",
scope=Scope.user_state)
history = List(help="History of randomize choices", scope=Scope.user_state)
suspended = List(help="Suspended problems", scope=Scope.settings)
class RandomizeModule(RandomizeFields, XModule):
......@@ -50,8 +51,6 @@ class RandomizeModule(RandomizeFields, XModule):
xml_attrs = self.descriptor.xml_attributes or []
self.use_randrange = self._str_to_bool(xml_attrs.get('use_randrange', ''))
self.no_repeats = self._str_to_bool(xml_attrs.get('no_repeats', ''))
suspended = xml_attrs.get('suspended', '').split(',')
self.suspended = [i.strip() for i in suspended if i.strip()]
self.pick_choice(use_randrange=self.use_randrange,
no_repeats=self.no_repeats, suspended=self.suspended)
......
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