MDL-40081 completion: clean up criteria records for deleted courses.
This commit is contained in:
+10
-1
@@ -498,7 +498,16 @@ class completion_info {
|
||||
*/
|
||||
public function clear_criteria() {
|
||||
global $DB;
|
||||
$DB->delete_records('course_completion_criteria', array('course' => $this->course_id));
|
||||
|
||||
// Remove completion criteria records for the course itself, and any records that refer to the course.
|
||||
$select = 'course = :course OR (criteriatype = :type AND courseinstance = :courseinstance)';
|
||||
$params = [
|
||||
'course' => $this->course_id,
|
||||
'type' => COMPLETION_CRITERIA_TYPE_COURSE,
|
||||
'courseinstance' => $this->course_id,
|
||||
];
|
||||
|
||||
$DB->delete_records_select('course_completion_criteria', $select, $params);
|
||||
$DB->delete_records('course_completion_aggr_methd', array('course' => $this->course_id));
|
||||
|
||||
$this->delete_course_completion_data();
|
||||
|
||||
Reference in New Issue
Block a user