]> git.mjollnir.org Git - moodle.git/commitdiff
Detect used scales in course outcomes too. MDL-13307 ; merged from 19_STABLE
authorstronk7 <stronk7>
Sun, 3 Feb 2008 16:40:34 +0000 (16:40 +0000)
committerstronk7 <stronk7>
Sun, 3 Feb 2008 16:40:34 +0000 (16:40 +0000)
lib/moodlelib.php

index bfed92f00921ccd6566172200fc36a866306d5bb..201c7327be6eaab95517cb4210b4fdfc70261093 100644 (file)
@@ -6813,6 +6813,14 @@ function course_scale_used($courseid, $scaleid) {
 
         // check if any course grade item makes use of the scale
         $return += count_records('grade_items', 'courseid', $courseid, 'scaleid', $scaleid);
+
+        // check if any outcome in the course makes use of the scale
+        $return += count_records_sql("SELECT COUNT(*)
+                                      FROM {$CFG->prefix}grade_outcomes_courses goc,
+                                           {$CFG->prefix}grade_outcomes go
+                                      WHERE go.id = goc.outcomeid
+                                        AND go.scaleid = $scaleid
+                                        AND goc.courseid = $courseid");
     }
     return $return;
 }