Code reinforcement

This commit is contained in:
PMKuipers 2025-01-01 14:02:35 +01:00
parent 35a0577d7d
commit eb7e459fcc

View file

@ -569,7 +569,9 @@ class studyitem {
// Add course if available. // Add course if available.
if (courseinfo::exists($this->r->course_id)) { if (courseinfo::exists($this->r->course_id)) {
$cinfo = $this->getcourseinfo(); $cinfo = $this->getcourseinfo();
$model['course'] = $cinfo->user_model($userid); if (is_object($cinfo)) {
$model['course'] = $cinfo->user_model($userid);
}
} }
// Add incoming and outgoing connection info. // Add incoming and outgoing connection info.
@ -608,7 +610,11 @@ class studyitem {
if (strtolower($this->r->type) == 'course') { if (strtolower($this->r->type) == 'course') {
// Determine competency by competency completion. // Determine competency by competency completion.
$courseinfo = $this->getcourseinfo(); $courseinfo = $this->getcourseinfo();
return $this->aggregator->aggregate_course($courseinfo, $this, $userid); if (is_object($courseinfo)) {
return $this->aggregator->aggregate_course($courseinfo, $this, $userid);
} else {
return completion::INCOMPLETE;
}
} else if (strtolower($this->r->type) == 'start') { } else if (strtolower($this->r->type) == 'start') {
// Does not need to use aggregator. // Does not need to use aggregator.
// Either true, or the completion of the reference. // Either true, or the completion of the reference.