Removed debug statements

This commit is contained in:
PMKuipers 2024-03-08 16:57:34 +01:00
parent 35afe06a91
commit a57ee3d884

View File

@ -176,8 +176,6 @@ class cascadecohortsync {
$lines = $this->studyplan->get_all_studylines(); $lines = $this->studyplan->get_all_studylines();
debug::write("Starting cohort sync cascading");
debug::dump($lines);
foreach($lines as $line) { foreach($lines as $line) {
$this->syncline($line); $this->syncline($line);
@ -189,20 +187,15 @@ class cascadecohortsync {
*/ */
public function syncline(studyline $line){ public function syncline(studyline $line){
global $DB; global $DB;
debug::dump($line->simple_model());
// Find the courses that need to be synced to the associated cohorts. // Find the courses that need to be synced to the associated cohorts.
$courseids = $line->get_linked_course_ids(); $courseids = $line->get_linked_course_ids();
if ($line->enrollable()) { if ($line->enrollable()) {
debug::write("Checking sycn for enrollable line {$line->name}");
// Since the studyline is enrollable, we need to cascade by student. // Since the studyline is enrollable, we need to cascade by student.
foreach ($courseids as $courseid) { foreach ($courseids as $courseid) {
/* 1: Associate the users by individual association */ /* 1: Associate the users by individual association */
$course = \get_course($courseid); $course = \get_course($courseid);
debug::write(" processing course {$course->shortname}");
$userids = $line->get_enrolled_userids(); $userids = $line->get_enrolled_userids();
debug::write(" Will attempt to enrol the following userids");
debug::dump($userids);
if (count($userids) > 0) { if (count($userids) > 0) {
// Get the manual enrol instance for this course. // Get the manual enrol instance for this course.
$instanceparams = ['courseid' => $courseid, 'enrol' => 'manual']; $instanceparams = ['courseid' => $courseid, 'enrol' => 'manual'];
@ -216,8 +209,6 @@ class cascadecohortsync {
} }
} }
if ($instance !== null) { if ($instance !== null) {
debug::write("Got manual enrol instance for this course");
debug::dump($instance);
foreach ($userids as $uid) { foreach ($userids as $uid) {
// Try a manual registration - it will just be updated if it is already there.... // Try a manual registration - it will just be updated if it is already there....
$this->manualenrol->enrol_user($instance, $uid, $this->roleid); $this->manualenrol->enrol_user($instance, $uid, $this->roleid);
@ -234,10 +225,7 @@ class cascadecohortsync {
if (get_config("local_treestudyplan", "csync_autoremove")) { if (get_config("local_treestudyplan", "csync_autoremove")) {
// Only try the autoremove if the option is enabled. // Only try the autoremove if the option is enabled.
debug::write("Checking for existing cohort syncs");
foreach($this->list_cohortsyncs($courseid) as $instance) { foreach($this->list_cohortsyncs($courseid) as $instance) {
debug::write("Got existing cohort sync, attempting to remove");
debug::dump($instance);
$this->unlink_cohortsync($instance); $this->unlink_cohortsync($instance);
} }