]> git.mjollnir.org Git - moodle.git/commitdiff
CEIL() uses fixed with new DML stuff. MDL-15336
authorstronk7 <stronk7>
Sat, 28 Jun 2008 19:04:25 +0000 (19:04 +0000)
committerstronk7 <stronk7>
Sat, 28 Jun 2008 19:04:25 +0000 (19:04 +0000)
lib/statslib.php

index 58531e01addc7d1d314b81cc39d2f77c95ab7b01..8b0960629919c806e1477afd6b44cb905aff8a90 100644 (file)
@@ -631,7 +631,7 @@ function stats_cron_weekly() {
     /// now enrolments averages
         $sql = "INSERT INTO {stats_weekly} (stattype, timeend, courseid, roleid, stat1, stat2)
 
-                SELECT 'enrolments', ntimeend, courseid, roleid, CEIL(AVG(stat1)), CEIL(AVG(stat2))
+                SELECT 'enrolments', ntimeend, courseid, roleid, " . $DB->sql_ceil('AVG(stat1)') . ", " . $DB->sql_ceil('AVG(stat2)') . "
                   FROM (
                            SELECT $nextstartweek AS ntimeend, courseid, roleid, stat1, stat2
                              FROM {stats_daily} sd
@@ -761,7 +761,7 @@ function stats_cron_monthly() {
     /// now enrolments averages
         $sql = "INSERT INTO {stats_monthly} (stattype, timeend, courseid, roleid, stat1, stat2)
 
-                SELECT 'enrolments', ntimeend, courseid, roleid, CEIL(AVG(stat1)), CEIL(AVG(stat2))
+                SELECT 'enrolments', ntimeend, courseid, roleid, " . $DB->sql_ceil('AVG(stat1)') . ", " . $DB->sql_ceil('AVG(stat2)') . "
                   FROM (
                            SELECT $nextstartmonth AS ntimeend, courseid, roleid, stat1, stat2
                              FROM {stats_daily} sd
@@ -1179,8 +1179,8 @@ function stats_get_parameters($time,$report,$courseid,$mode,$roleid=0) {
             $threshold = $CFG->statsuserthreshold;
         }
         $param->fields = '';
-        $param->sql = 'SELECT courseid, ceil(avg(all_enrolments)) as line1,
-                         ceil(avg(active_enrolments)) as line2, avg(proportion_active) AS line3
+        $param->sql = 'SELECT courseid, ' . $DB->sql_ceil('avg(all_enrolments)') . ' as line1, ' .
+                         $DB->sql_ceil('avg(active_enrolments)') . ' as line2, avg(proportion_active) AS line3
                        FROM (
                            SELECT courseid, timeend, stat2 as active_enrolments,
                                   stat1 as all_enrolments, '.$DB->sql_cast_char2real('stat2').'/'.$DB->sql_cast_char2real('stat1').' AS proportion_active