Skip to content

Commit

Permalink
Merge branch 'MDL-60718-master' of git://github.com/sarjona/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Nov 9, 2017
2 parents 7fdcdc0 + 0c0d460 commit a4e0b74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions analytics/classes/course.php
Expand Up @@ -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
Expand Down

0 comments on commit a4e0b74

Please sign in to comment.