Skip to content

Commit

Permalink
processes subcourse completion condition
Browse files Browse the repository at this point in the history
  • Loading branch information
iceripple authored Jan 14, 2025
1 parent 973c476 commit bb6c978
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ function subcourse_get_coursemodule_info($coursemodule) {
global $CFG, $DB;

$subcourse = $DB->get_record('subcourse', ['id' => $coursemodule->instance],
'id, name, intro, introformat, instantredirect, blankwindow, coursepageprintgrade, coursepageprintprogress');
'id, name, intro, introformat, instantredirect, blankwindow, coursepageprintgrade, coursepageprintprogress, completioncourse');

if (!$subcourse) {
return null;
Expand All @@ -387,6 +387,12 @@ function subcourse_get_coursemodule_info($coursemodule) {
$info->content = format_module_intro('subcourse', $subcourse, $coursemodule->id, false);
}

// Populate the custom completion rules as key => value pairs, but only if the completion mode is 'automatic'.
if ($coursemodule->completion == COMPLETION_TRACKING_AUTOMATIC) {
$info->customdata->customcompletionrules['completioncourse'] = $subcourse->completioncourse;
}


return $info;
}

Expand Down

0 comments on commit bb6c978

Please sign in to comment.