Commit 79fdb79e by Vik Paruchuri

Fixing states and html display

parent d2ef85cc
...@@ -131,7 +131,7 @@ class CombinedOpenEndedModule(XModule): ...@@ -131,7 +131,7 @@ class CombinedOpenEndedModule(XModule):
self.state=self.ASSESSING self.state=self.ASSESSING
elif current_task_state is None and self.current_task_number>0: elif current_task_state is None and self.current_task_number>0:
last_response, last_score=self.get_last_response(self.current_task_number-1) last_response, last_score=self.get_last_response(self.current_task_number-1)
current_task_state = ('{"state": "assessing", "version": 1, "max_score": ' + str(self._max_score) + ', ' + current_task_state = ('{"state": "initial", "version": 1, "max_score": ' + str(self._max_score) + ', ' +
'"attempts": 0, "history": [{"answer": "' + str(last_response) + '"}]}') '"attempts": 0, "history": [{"answer": "' + str(last_response) + '"}]}')
{"state": "done", "version": 1, "max_score": 1, "attempts": 1, "history": [{"answer": "gdgddg", "score": 0, "hint": "dfdfdf"}]} {"state": "done", "version": 1, "max_score": 1, "attempts": 1, "history": [{"answer": "gdgddg", "score": 0, "hint": "dfdfdf"}]}
self.current_task=open_ended_module.OpenEndedModule(self.system, self.location, self.current_task_parsed_xml, self.current_task_descriptor, instance_state=current_task_state) self.current_task=open_ended_module.OpenEndedModule(self.system, self.location, self.current_task_parsed_xml, self.current_task_descriptor, instance_state=current_task_state)
......
...@@ -576,20 +576,20 @@ class OpenEndedModule(): ...@@ -576,20 +576,20 @@ class OpenEndedModule():
def latest_answer(self): def latest_answer(self):
"""None if not available""" """None if not available"""
if not self.history: if not self.history:
return None return ""
return self.history[-1].get('answer') return self.history[-1].get('answer', "")
def latest_score(self): def latest_score(self):
"""None if not available""" """None if not available"""
if not self.history: if not self.history:
return None return ""
return self.history[-1].get('score') return self.history[-1].get('score', "")
def latest_feedback(self): def latest_feedback(self):
"""None if not available""" """None if not available"""
if not self.history: if not self.history:
return None return ""
return self.history[-1].get('feedback') return self.history[-1].get('feedback', "")
def new_history_entry(self, answer): def new_history_entry(self, answer):
self.history.append({'answer': answer}) self.history.append({'answer': answer})
......
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