diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index a891474581..0d810af87a 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -179,6 +179,8 @@ class CapaModule(XModule): return "per_student" elif rerandomize == "never": return "never" + elif rerandomize == "onreset": + return "onreset" else: raise Exception("Invalid rerandomize attribute " + rerandomize) @@ -307,7 +309,7 @@ class CapaModule(XModule): save_button = False # Only show the reset button if pressing it will show different values - if self.rerandomize != 'always': + if self.rerandomize not in ["always", "onreset"]: reset_button = False # User hasn't submitted an answer yet -- we don't want resets @@ -617,7 +619,7 @@ class CapaModule(XModule): return "Refresh the page and make an attempt before resetting." self.lcp.do_reset() - if self.rerandomize == "always": + if self.rerandomize in ["always", "onreset"]: # reset random number generator seed (note the self.lcp.get_state() # in next line) self.lcp.seed = None diff --git a/doc/xml-format.md b/doc/xml-format.md index 342b807eb8..b8aaf78b44 100644 --- a/doc/xml-format.md +++ b/doc/xml-format.md @@ -281,6 +281,7 @@ __Inherited:__ * `showanswer` - When to show answer. For 'attempted', will show answer after first attempt. Values: never, attempted, answered, closed. Default: closed. Optional. * `graded` - Whether this section will count towards the students grade. "true" or "false". Defaults to "false". * `rerandomise` - Randomize question on each attempt. Values: 'always' (students see a different version of the problem after each attempt to solve it) + 'onreset' (students see a different version of the problem when they reset, but are not forced to reset after each check) 'never' (all students see the same version of the problem) 'per_student' (individual students see the same version of the problem each time the look at it, but that version is different from what other students see) Default: 'always'. Optional.