Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

datalib: get_logs_user*() - fix invalid SQL - MDL-12426

Oracle does not accept column labels in the GROUP BY section -
get_logs_usercourse() and get_logs_userday() were computing the
day/hours column and using it in the GROUP BY. The compatible fix
is to reproduce the same computation in the GROUP BY section.

Credit for the fix goes to Dennis Rochford <Dennis.Rochford@usq.edu.au>.
  • Loading branch information...
commit 77a53d26bb7917e5957f99869a5d1c6d9798a0e2 1 parent 414b66b
martinlanghoff authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/datalib.php
View
4 lib/datalib.php
@@ -1663,7 +1663,7 @@ function get_logs_usercourse($userid, $courseid, $coursestart) {
FROM {$CFG->prefix}log
WHERE userid = '$userid'
AND time > '$coursestart' $courseselect
- GROUP BY day ");
+ GROUP BY floor((time - $coursestart)/". DAYSECS .") ");
}
/**
@@ -1690,7 +1690,7 @@ function get_logs_userday($userid, $courseid, $daystart) {
FROM {$CFG->prefix}log
WHERE userid = '$userid'
AND time > '$daystart' $courseselect
- GROUP BY hour ");
+ GROUP BY floor((time - $daystart)/". HOURSECS .") ");
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.