MDL-75173 core_completion: Fix course completion criteria marking.

SQL was fetching activities where completion state was 'completed,
but not passed reqyured grade'. For course completion such states
must be ignored.

Also fixed progress bar on my courses page. Same reasoning as above.
This commit is contained in:
Ilya Tregubov
2022-10-14 11:49:28 +03:00
parent e4c5a12a1c
commit def5d29730
3 changed files with 95 additions and 3 deletions
+5 -1
View File
@@ -80,7 +80,11 @@ class progress {
$completed = 0;
foreach ($modules as $module) {
$data = $completion->get_data($module, true, $userid);
$completed += $data->completionstate == COMPLETION_INCOMPLETE ? 0 : 1;
if (($data->completionstate == COMPLETION_INCOMPLETE) || ($data->completionstate == COMPLETION_COMPLETE_FAIL)) {
$completed += 0;
} else {
$completed += 1;
};
}
return ($completed / $count) * 100;