Persist student answers on input error
LMS-469
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user