Skip to content

Commit

Permalink
datalib MDL-14679 Fixed regression in get_logs_userday function, miss…
Browse files Browse the repository at this point in the history
…ing argument
  • Loading branch information
Sam Hemelryk committed Mar 18, 2010
1 parent 2d10c08 commit 66a0612
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions lib/datalib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2263,21 +2263,20 @@ function get_logs_usercourse($userid, $courseid, $coursestart) {
function get_logs_userday($userid, $courseid, $daystart) {
global $DB;

$params = array();
$params = array($daystart, $userid, $daystart);

$courseselect = '';
if ($courseid) {
$courseselect = "AND course = :courseid";
$params['courseid'] = $courseid;
$courseselect = "AND course = ?";
$params[] = $courseid;
}
$params['userid'] = $userid;
$params['daystart'] = $daystart;
$params[] = $daystart;

return $DB->get_records_sql("SELECT FLOOR((time - :daystart)/". HOURSECS .") AS hour, COUNT(*) AS num
return $DB->get_records_sql("SELECT FLOOR((time - ?)/". HOURSECS .") AS hour, COUNT(*) AS num
FROM {log}
WHERE userid = :userid
AND time > :daystart $courseselect
GROUP BY FLOOR((time - :daystart)/". HOURSECS .") ");
WHERE userid = ?
AND time > ? $courseselect
GROUP BY FLOOR((time - ?)/". HOURSECS .") ", $params);
}

/**
Expand Down

0 comments on commit 66a0612

Please sign in to comment.