Skip to content

Commit

Permalink
Merge branch 'MDL-45145_master' of https://github.com/markn86/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Apr 21, 2014
2 parents 085c68d + a97a758 commit eec3795
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mod/quiz/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ function quiz_delete_attempt($attempt, $quiz) {
return;
}

if (!isset($quiz->cmid)) {
$cm = get_coursemodule_from_instance('quiz', $quiz->id, $quiz->course);
$quiz->cmid = $cm->id;
}

question_engine::delete_questions_usage_by_activity($attempt->uniqueid);
$DB->delete_records('quiz_attempts', array('id' => $attempt->id));

Expand Down
2 changes: 2 additions & 0 deletions mod/quiz/report/attemptsreport.php
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ protected function delete_selected_attempts($quiz, $cm, $attemptids, $allowed) {
continue;
}

// Set the course module id before calling quiz_delete_attempt().
$quiz->cmid = $cm->id;
quiz_delete_attempt($attempt, $quiz);
}
}
Expand Down

0 comments on commit eec3795

Please sign in to comment.