Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #95: prevent empty referenced course id coding error #96

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,13 @@ function subcourse_update_grades($subcourse, $userid=0, $nullifnone=true) {
require_once($CFG->dirroot . '/mod/subcourse/locallib.php');
require_once($CFG->libdir.'/gradelib.php');

$refgrades = subcourse_fetch_refgrades($subcourse->id, $subcourse->refcourse, false, $userid, false);

if ($subcourse->refcourse) {
$refgrades = subcourse_fetch_refgrades($subcourse->id, $subcourse->refcourse, false, $userid, false);
} else {
// Prevent empty referenced course id coding error.
return GRADE_UPDATE_FAILED;
}

if ($refgrades && $refgrades->grades) {
if (!empty($refgrades->localremotescale)) {
// Unable to fetch remote grades - local scale is used in the remote course.
Expand Down
Loading