mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-45145 mod_quiz: ensure quiz cmid is set before triggering the 'attempt_deleted' event
This commit is contained in:
parent
a0461340ff
commit
a97a7585ff
@ -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));
|
||||
|
||||
|
@ -318,6 +318,8 @@ abstract class quiz_attempts_report extends quiz_default_report {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Set the course module id before calling quiz_delete_attempt().
|
||||
$quiz->cmid = $cm->id;
|
||||
quiz_delete_attempt($attempt, $quiz);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user