Commit f3ca5f45 by Vik Paruchuri

Save answer based on history

parent 85776fbe
...@@ -532,7 +532,11 @@ class OpenEndedModule(): ...@@ -532,7 +532,11 @@ class OpenEndedModule():
return self.out_of_sync_error(get) return self.out_of_sync_error(get)
# add new history element with answer and empty score and hint. # add new history element with answer and empty score and hint.
self.new_history_entry(get['student_answer']) if(len(self.history)>0):
if(len(self.history[-1].keys())>1):
self.new_history_entry(get['student_answer'])
else:
get['student_answer']=self.latest_answer()
self.get_score(get['student_answer'], system) self.get_score(get['student_answer'], system)
self.change_state(self.ASSESSING) self.change_state(self.ASSESSING)
...@@ -632,7 +636,6 @@ class OpenEndedModule(): ...@@ -632,7 +636,6 @@ class OpenEndedModule():
'allow_reset': self._allow_reset(), 'allow_reset': self._allow_reset(),
'rows' : 30, 'rows' : 30,
'cols' : 80, 'cols' : 80,
'hidden' : '',
'id' : 'open_ended', 'id' : 'open_ended',
'msg' : self.latest_feedback(), 'msg' : self.latest_feedback(),
'child_type' : 'openended', 'child_type' : 'openended',
......
...@@ -4,11 +4,7 @@ ...@@ -4,11 +4,7 @@
<div class="prompt"> <div class="prompt">
${prompt|n} ${prompt|n}
</prompt> </prompt>
<textarea rows="${rows}" cols="${cols}" name="answer" class="answer short-form-response" id="input_${id}" <textarea rows="${rows}" cols="${cols}" name="answer" class="answer short-form-response" id="input_${id}">${previous_answer|h}</textarea>
% if hidden:
style="display:none;"
% endif
>${previous_answer|h}</textarea>
<div class="message-wrapper"> <div class="message-wrapper">
% if state == 'initial': % if state == 'initial':
......
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