MDL-75727 question regrading: fix each attempt builds on last

This fixes a regression caused by MDL-74752. If you regraded
a subsequent quiz attempt in a quiz using the 'Each attempt
builds on last' option, then the student's response could get lost.
This commit is contained in:
Tim Hunt
2022-10-12 11:10:55 +01:00
parent e4c5a12a1c
commit 06c63f7aa1
6 changed files with 136 additions and 5 deletions
+3
View File
@@ -238,6 +238,9 @@ abstract class question_definition {
* A different version of the question will have different question_answers with different ids. However, the list of
* choices should be similar, and so we need to shuffle the new list of ids in the same way that the old one was.
*
* Note: be sure to return all the data that was originally in $oldstep, while updating the fields that
* require it. Otherwise you might break features like 'Each attempt builds on last' in the quiz.
*
* This method should only be called if {@see validate_can_regrade_with_other_version()} did not
* flag up a potential problem. So, this method will throw a {@see coding_exception} if it is not
* possible to work out a return value.