numbas / Numbas

A completely browser-based e-assessment/e-learning system, with an emphasis on mathematics
http://www.numbas.org.uk
Apache License 2.0
198 stars 118 forks source link

Issue with Mastery Test review when using LTI server #999

Closed dshearman closed 1 year ago

dshearman commented 1 year ago

If a student leaves a Mastery test by clicking the End Exam button in the exam immediately after having clicked Submit Answer (ie before clicking the Move to next question button), an attempt to review the test on the LTI server gives an error "Numbas Error: Error computing referenced variable after_answering". The result summary is shown directly after clicking the End Exam button, so the error appears to be in the saved JSON data. A cursory review of the JSON data suggests that the question_queue variable is empty when leaving the exam as described above but contains data if Move to next question is clicked before endng exam. Not sure if this is relevant.

christianp commented 1 year ago

Thanks for reporting this, @dshearman! I think the problem was that the "after exam ended" note was run a second time when the exam is resumed. When resuming the exam, the end() method is called in order to reconstruct the final state, but it's not supposed to do anything that would represent a change to the state compared to the last session.