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