Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions classes/table/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,13 @@ public function out($pagesize, $useinitialsbar, $downloadhelpbutton = '') {
public function query_db($pagesize, $useinitialsbar = true) {
global $DB;

$fields = \core_user\fields::for_userpic()->with_identity($this->context)
->get_sql('u', false, '', '', false)->selects;
$userfields = \core_user\fields::for_userpic()->with_identity($this->context)
->get_sql('u', true, '', '', false);

$params = ['courseid' => $this->courseid];

$params += $userfields->params;

$showinactive = !!get_config('block_completion_progress', 'showinactive');
$enroljoin = get_enrolled_with_capabilities_join($this->context, '', '', 0, !$showinactive);
$params += $enroljoin->params;
Expand Down Expand Up @@ -283,8 +285,8 @@ public function query_db($pagesize, $useinitialsbar = true) {
}

$this->rawdata = $DB->get_records_sql(
"SELECT DISTINCT $fields, l.timeaccess, b.percentage AS progress, b.timemodified AS progressage
FROM {user} u {$enroljoin->joins} {$fjoins}
"SELECT DISTINCT {$userfields->selects}, l.timeaccess, b.percentage AS progress, b.timemodified AS progressage
FROM {user} u {$enroljoin->joins} {$fjoins} {$userfields->joins}
LEFT JOIN {user_lastaccess} l ON l.userid = u.id AND l.courseid = :courseid
LEFT JOIN {block_completion_progress} b ON b.userid = u.id AND b.blockinstanceid = :bi
WHERE {$enroljoin->wheres} AND {$twhere} AND ({$fwheres})
Expand Down
Loading