MDL-68715 completion: fix form default value for course prerequisites.
Adds filtering on the completion criteria form to ensure we are only selecting actual course instances of this type. Prior to this change we would also get NULL values from unrelated criteria types.
This commit is contained in:
@@ -2498,5 +2498,16 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2020062600.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2020071100.01) {
|
||||
// Clean up completion criteria records referring to NULL course prerequisites.
|
||||
$select = 'criteriatype = :type AND courseinstance IS NULL';
|
||||
$params = ['type' => 8]; // COMPLETION_CRITERIA_TYPE_COURSE.
|
||||
|
||||
$DB->delete_records_select('course_completion_criteria', $select, $params);
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2020071100.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user