Commit f155bd09 by Calen Pennington

Merge pull request #1655 from MITx/fix/vik/oe-xblock-stage

Potentially fix xblock storage model for open ended
parents f6b4d3aa 19e3e79c
...@@ -130,6 +130,7 @@ class CombinedOpenEndedModule(XModule): ...@@ -130,6 +130,7 @@ class CombinedOpenEndedModule(XModule):
modules = [i[2] for i in VERSION_TUPLES] modules = [i[2] for i in VERSION_TUPLES]
settings_attributes = [i[3] for i in VERSION_TUPLES] settings_attributes = [i[3] for i in VERSION_TUPLES]
student_attributes = [i[4] for i in VERSION_TUPLES] student_attributes = [i[4] for i in VERSION_TUPLES]
version_error_string = "Could not find version {0}, using version {1} instead"
try: try:
version_index = versions.index(self.version) version_index = versions.index(self.version)
...@@ -151,7 +152,8 @@ class CombinedOpenEndedModule(XModule): ...@@ -151,7 +152,8 @@ class CombinedOpenEndedModule(XModule):
self.child_descriptor = descriptors[version_index](self.system) self.child_descriptor = descriptors[version_index](self.system)
self.child_definition = descriptors[version_index].definition_from_xml(etree.fromstring(self.data), self.system) self.child_definition = descriptors[version_index].definition_from_xml(etree.fromstring(self.data), self.system)
self.child_module = modules[version_index](self.system, location, self.child_definition, self.child_descriptor, self.child_module = modules[version_index](self.system, location, self.child_definition, self.child_descriptor,
instance_state = instance_state, static_data= static_data, model_data=model_data, attributes=attributes) instance_state = instance_state, static_data= static_data, attributes=attributes)
self.save_instance_data()
def get_html(self): def get_html(self):
self.save_instance_data() self.save_instance_data()
......
...@@ -81,7 +81,7 @@ class CombinedOpenEndedV1Module(): ...@@ -81,7 +81,7 @@ class CombinedOpenEndedV1Module():
TEMPLATE_DIR = "combinedopenended" TEMPLATE_DIR = "combinedopenended"
def __init__(self, system, location, definition, descriptor, def __init__(self, system, location, definition, descriptor,
instance_state=None, shared_state=None, metadata = None, static_data = None, model_data=None,**kwargs): instance_state=None, shared_state=None, metadata = None, static_data = None, **kwargs):
""" """
Definition file should have one or many task blocks, a rubric block, and a prompt block: Definition file should have one or many task blocks, a rubric block, and a prompt block:
...@@ -118,7 +118,6 @@ class CombinedOpenEndedV1Module(): ...@@ -118,7 +118,6 @@ class CombinedOpenEndedV1Module():
""" """
self._model_data = model_data
self.instance_state = instance_state self.instance_state = instance_state
self.display_name = instance_state.get('display_name', "Open Ended") self.display_name = instance_state.get('display_name', "Open Ended")
self.rewrite_content_links = static_data.get('rewrite_content_links',"") self.rewrite_content_links = static_data.get('rewrite_content_links',"")
...@@ -396,7 +395,7 @@ class CombinedOpenEndedV1Module(): ...@@ -396,7 +395,7 @@ class CombinedOpenEndedV1Module():
task_parsed_xml = task_descriptor.definition_from_xml(etree_xml, self.system) task_parsed_xml = task_descriptor.definition_from_xml(etree_xml, self.system)
task = children['modules'][task_type](self.system, self.location, task_parsed_xml, task_descriptor, task = children['modules'][task_type](self.system, self.location, task_parsed_xml, task_descriptor,
self.static_data, instance_state=task_state, model_data = self._model_data) self.static_data, instance_state=task_state)
last_response = task.latest_answer() last_response = task.latest_answer()
last_score = task.latest_score() last_score = task.latest_score()
last_post_assessment = task.latest_post_assessment(self.system) last_post_assessment = task.latest_post_assessment(self.system)
......
...@@ -72,7 +72,7 @@ class OpenEndedChild(object): ...@@ -72,7 +72,7 @@ class OpenEndedChild(object):
try: try:
instance_state = json.loads(instance_state) instance_state = json.loads(instance_state)
except: except:
pass log.error("Could not load instance state for open ended. Setting it to nothing.: {0}".format(instance_state))
else: else:
instance_state = {} instance_state = {}
......
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