In an adaptive quiz, a question's grade_response() method is called when the user clicks the "check" button. For efficiency, the code in question/behaviour/adaptive/behaviour.php (method process_submit) suppresses that call if the student's answer has not changed since it was last graded. When the student finally submits and closes their quiz, the process_finish method of the same behaviour class does not check to see if the answer has changed, with the result that an unnecessary call to grade_response takes place for all questions. Although this is not a significant problem with standard question types, it is an issue with new question types where the grading cost is significant, particularly in a laboratory test environment. At the end of the test, all quizzes are submitted and typically all questions from all students get regraded unnecessarily at the same time.
Steps to reproduce:
1. Run Moodle in a debugging environment, setting a breakpoint (or other diagnostic tool) at the start of the grade_response() method of any particular question type, e.g. qtype_truefalse_question
2. Create a quiz with an adaptive behaviour containing just one question of the type being monitored (e.g. qtype_truefalse_question)
3. Preview the quiz.
4. Enter an answer for the question and click CHECK. The code should stop on the breakpoint. Click Run (or whatever) to continue execution.
5. Click CHECK again (without changing the answer). This time the breakpoint should not be encountered as the behaviour doesn't bother regrading an already-graded question.
6. Click NEXT then "Submit all and Finish" (and again on the confirmation dialogue).
7. The breakpoint will again be encountered, which is an unnecessary regrading.