MDL-77781 core_completion: Completion view must be deleted too

When resetting a course, completion view entries should also be
deleted

Co-authored-by: Georg Moser <[email protected]>
This commit is contained in:
Laurent David
2023-05-03 16:05:10 +02:00
committed by Sara Arjona
co-authored by Georg Moser
parent da46551bea
commit 16f91dfdb3
2 changed files with 46 additions and 1 deletions
+3 -1
View File
@@ -928,7 +928,9 @@ class completion_info {
$DB->delete_records_select('course_modules_completion',
'coursemoduleid IN (SELECT id FROM {course_modules} WHERE course=?)',
array($this->course_id));
$DB->delete_records_select('course_modules_viewed',
'coursemoduleid IN (SELECT id FROM {course_modules} WHERE course=?)',
[$this->course_id]);
// Wipe course completion data too.
$this->delete_course_completion_data();
}