MDL-27696 datalib Fixed up misused params in get_logs_usercourse
authorSam Hemelryk <sam@moodle.com>
Tue, 5 Jul 2011 02:45:28 +0000 (10:45 +0800)
committerSam Hemelryk <sam@moodle.com>
Wed, 13 Jul 2011 02:30:35 +0000 (10:30 +0800)
lib/datalib.php

index 45ced89..63b7f39 100644 (file)
@@ -1844,13 +1844,15 @@ function get_logs_usercourse($userid, $courseid, $coursestart) {
         $params['courseid'] = $courseid;
     }
     $params['userid'] = $userid;
-    $params['coursestart'] = $coursestart;
+    $params['coursestart1'] = $coursestart;
+    $params['coursestart2'] = $coursestart;
+    $params['coursestart3'] = $coursestart;
 
-    return $DB->get_records_sql("SELECT FLOOR((time - :coursestart)/". DAYSECS .") AS day, COUNT(*) AS num
+    return $DB->get_records_sql("SELECT FLOOR((time - :coursestart1)/". DAYSECS .") AS day, COUNT(*) AS num
                                    FROM {log}
                                   WHERE userid = :userid
-                                        AND time > :coursestart $courseselect
-                               GROUP BY FLOOR((time - :coursestart)/". DAYSECS .")", $params);
+                                        AND time > :coursestart2 $courseselect
+                               GROUP BY FLOOR((time - :coursestart3)/". DAYSECS .")", $params);
 }
 
 /**