Save answer based on history

This commit is contained in:
Vik Paruchuri
2013-01-04 15:32:56 -05:00
parent 85776fbe30
commit f3ca5f456f
2 changed files with 6 additions and 7 deletions

View File

@@ -532,7 +532,11 @@ class OpenEndedModule():
return self.out_of_sync_error(get)
# 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.change_state(self.ASSESSING)
@@ -632,7 +636,6 @@ class OpenEndedModule():
'allow_reset': self._allow_reset(),
'rows' : 30,
'cols' : 80,
'hidden' : '',
'id' : 'open_ended',
'msg' : self.latest_feedback(),
'child_type' : 'openended',

View File

@@ -4,11 +4,7 @@
<div class="prompt">
${prompt|n}
</prompt>
<textarea rows="${rows}" cols="${cols}" name="answer" class="answer short-form-response" id="input_${id}"
% if hidden:
style="display:none;"
% endif
>${previous_answer|h}</textarea>
<textarea rows="${rows}" cols="${cols}" name="answer" class="answer short-form-response" id="input_${id}">${previous_answer|h}</textarea>
<div class="message-wrapper">
% if state == 'initial':