Merge branch 'MDL-34251_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE

This commit is contained in:
Dan Poltawski
2012-07-23 14:02:15 +08:00
2 changed files with 17 additions and 0 deletions
+9
View File
@@ -1213,6 +1213,15 @@ class question_attempt {
$qa->behaviour = question_engine::make_behaviour(
$record->behaviour, $qa, $preferredbehaviour);
// If attemptstepid is null (which should not happen, but has happened
// due to corrupt data, see MDL-34251) then the current pointer in $records
// will not be advanced in the while loop below, and we get stuck in an
// infinite loop, since this method is supposed to always consume at
// least one record. Therefore, in this case, advance the record here.
if (is_null($record->attemptstepid)) {
$records->next();
}
$i = 0;
while ($record && $record->questionattemptid == $questionattemptid && !is_null($record->attemptstepid)) {
$qa->steps[$i] = question_attempt_step::load_from_records($records, $record->attemptstepid);
+8
View File
@@ -706,6 +706,14 @@ class question_usage_by_activity {
$quba->observer = new question_engine_unit_of_work($quba);
// If slot is null then the current pointer in $records will not be
// advanced in the while loop below, and we get stuck in an infinite loop,
// since this method is supposed to always consume at least one record.
// Therefore, in this case, advance the record here.
if (is_null($record->slot)) {
$records->next();
}
while ($record && $record->qubaid == $qubaid && !is_null($record->slot)) {
$quba->questionattempts[$record->slot] =
question_attempt::load_from_records($records,