Permalink
Browse files

Merge branch 'MDL-60718-master' of git://github.com/sarjona/moodle

  • Loading branch information...
dmonllao committed Nov 9, 2017
2 parents 7fdcdc0 + 0c0d460 commit a4e0b7468cfdda64305eba0022d0735328853a50
Showing with 2 additions and 2 deletions.
  1. +2 −2 analytics/classes/course.php
@@ -356,15 +356,15 @@ public function guess_end() {
$monthsago = time() - (WEEKSECS * 4 * 2);
$select = $filterselect . ' AND timeaccess > :timeaccess';
$params = $filterparams + array('timeaccess' => $monthsago);
$sql = "SELECT timeaccess FROM {user_lastaccess} ula
$sql = "SELECT DISTINCT timeaccess FROM {user_lastaccess} ula
JOIN {enrol} e ON e.courseid = ula.courseid
JOIN {user_enrolments} ue ON e.id = ue.enrolid AND ue.userid = ula.userid
WHERE $select";
if ($records = $DB->get_records_sql($sql, $params)) {
return 0;
}
$sql = "SELECT timeaccess FROM {user_lastaccess} ula
$sql = "SELECT DISTINCT timeaccess FROM {user_lastaccess} ula
JOIN {enrol} e ON e.courseid = ula.courseid
JOIN {user_enrolments} ue ON e.id = ue.enrolid AND ue.userid = ula.userid
WHERE $filterselect AND ula.timeaccess != 0

0 comments on commit a4e0b74

Please sign in to comment.