Commit fddb3ce4 by Justin Riley

add support for hidden=true in randomize xmodule

Support a new 'hidden' xml attribute for <problem>. If set to 'true' the
problem will be excluded from the list of choices within the randomize
xmodule.
parent 5c2d3e16
...@@ -102,6 +102,8 @@ class RandomizeModule(RandomizeFields, XModule): ...@@ -102,6 +102,8 @@ class RandomizeModule(RandomizeFields, XModule):
if self.choice is None and no_repeats: if self.choice is None and no_repeats:
history = json.loads(self.history or '[]') history = json.loads(self.history or '[]')
children = [c for c in children if c.location.url() not in history] children = [c for c in children if c.location.url() not in history]
children = [c for c in children if not
self._str_to_bool(c.xml_attributes.get('hidden', ''))]
return OrderedDict([(c.location.url(), c) for c in children]) return OrderedDict([(c.location.url(), c) for c in children])
def get_choice_index(self, choice=None, choices=None): def get_choice_index(self, choice=None, choices=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