Commit 10128363 by Justin Riley

reset choice if current choice was removed from XML

parent cd54ac35
...@@ -62,10 +62,17 @@ class RandomizeModule(RandomizeFields, XModule): ...@@ -62,10 +62,17 @@ class RandomizeModule(RandomizeFields, XModule):
choices = self.get_choices(no_repeats=no_repeats, suspended=suspended) choices = self.get_choices(no_repeats=no_repeats, suspended=suspended)
all_choices = self.get_choices() all_choices = self.get_choices()
current_child = all_choices.get(self.choice) current_child = all_choices.get(self.choice)
if current_child and self.choice not in choices: if current_child:
if current_child.location.name not in suspended: cloc = current_child.location
# Children changed. Reset. if cloc.url() not in choices and cloc.name not in (suspended or []):
# child exists but is not in the list of choices. dont
# reset suspended problems otherwise students that passed will
# lose their grade.
self.choice = None self.choice = None
elif self.choice is not None:
log.warn("Problem removed from course XML: %s" % self.choice)
# current choice no longer exists in course XML - reset
self.choice = None
if self.choice is None: if self.choice is None:
num_choices = len(choices) num_choices = len(choices)
......
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