diff --git a/common/lib/capa/capa/responsetypes.py b/common/lib/capa/capa/responsetypes.py index 02767514a3..4b9996b2bb 100644 --- a/common/lib/capa/capa/responsetypes.py +++ b/common/lib/capa/capa/responsetypes.py @@ -1805,7 +1805,10 @@ class FormulaResponse(LoncapaResponse): def get_score(self, student_answers): given = student_answers[self.answer_id] correctness = self.check_formula( - self.correct_answer, given, self.samples) + self.correct_answer, + given, + self.samples + ) return CorrectMap(self.answer_id, correctness) def tupleize_answers(self, answer, var_dict_list): diff --git a/common/lib/xmodule/xmodule/capa_module.py b/common/lib/xmodule/xmodule/capa_module.py index 3b2907f041..d5109aae32 100644 --- a/common/lib/xmodule/xmodule/capa_module.py +++ b/common/lib/xmodule/xmodule/capa_module.py @@ -941,6 +941,9 @@ class CapaModule(CapaFields, XModule): log.warning("StudentInputError in capa_module:problem_check", exc_info=True) + # Save the user's state before failing + self.set_state_from_lcp() + # If the user is a staff member, include # the full exception, including traceback, # in the response @@ -955,6 +958,9 @@ class CapaModule(CapaFields, XModule): return {'success': msg} except Exception as err: + # Save the user's state before failing + self.set_state_from_lcp() + if self.system.DEBUG: msg = u"Error checking problem: {}".format(err.message) msg += u'\nTraceback:\n{}'.format(traceback.format_exc())