Commit 862beafd by Sarina Canelake

Persist student answers on input error

LMS-469
parent 32bc26c6
...@@ -1805,7 +1805,10 @@ class FormulaResponse(LoncapaResponse): ...@@ -1805,7 +1805,10 @@ class FormulaResponse(LoncapaResponse):
def get_score(self, student_answers): def get_score(self, student_answers):
given = student_answers[self.answer_id] given = student_answers[self.answer_id]
correctness = self.check_formula( correctness = self.check_formula(
self.correct_answer, given, self.samples) self.correct_answer,
given,
self.samples
)
return CorrectMap(self.answer_id, correctness) return CorrectMap(self.answer_id, correctness)
def tupleize_answers(self, answer, var_dict_list): def tupleize_answers(self, answer, var_dict_list):
......
...@@ -941,6 +941,9 @@ class CapaModule(CapaFields, XModule): ...@@ -941,6 +941,9 @@ class CapaModule(CapaFields, XModule):
log.warning("StudentInputError in capa_module:problem_check", log.warning("StudentInputError in capa_module:problem_check",
exc_info=True) exc_info=True)
# Save the user's state before failing
self.set_state_from_lcp()
# If the user is a staff member, include # If the user is a staff member, include
# the full exception, including traceback, # the full exception, including traceback,
# in the response # in the response
...@@ -955,6 +958,9 @@ class CapaModule(CapaFields, XModule): ...@@ -955,6 +958,9 @@ class CapaModule(CapaFields, XModule):
return {'success': msg} return {'success': msg}
except Exception as err: except Exception as err:
# Save the user's state before failing
self.set_state_from_lcp()
if self.system.DEBUG: if self.system.DEBUG:
msg = u"Error checking problem: {}".format(err.message) msg = u"Error checking problem: {}".format(err.message)
msg += u'\nTraceback:\n{}'.format(traceback.format_exc()) msg += u'\nTraceback:\n{}'.format(traceback.format_exc())
......
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