From ad275cb4adee492b51e66e10af13b5a2e9982e73 Mon Sep 17 00:00:00 2001 From: sam marshall Date: Tue, 9 Aug 2011 12:45:58 +0100 Subject: [PATCH] MDL-28643 Fix debugging message when deleting activity with grade completion --- lib/grade/grade_grade.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/grade/grade_grade.php b/lib/grade/grade_grade.php index 97c4233711f..3278e7c7fb7 100644 --- a/lib/grade/grade_grade.php +++ b/lib/grade/grade_grade.php @@ -794,10 +794,16 @@ class grade_grade extends grade_object { // Get course-module $cm = get_coursemodule_from_instance($this->grade_item->itemmodule, $this->grade_item->iteminstance, $this->grade_item->courseid); + // If the course-module doesn't exist, display a warning... if (!$cm) { - debugging("Couldn't find course-module for module - '{$this->grade_item->itemmodule}', instance '{$this->grade_item->iteminstance}', - course '{$this->grade_item->courseid}'"); + // ...unless the grade is being deleted in which case it's likely + // that the course-module was just deleted too, so that's okay. + if (!$deleted) { + debugging("Couldn't find course-module for module '" . + $this->grade_item->itemmodule . "', instance '" . + $this->grade_item->iteminstance . "', course '" . + $this->grade_item->courseid . "'"); + } return; } -- 2.43.0