Applied DISTINCT as per Martin Langhoff's solution in MDL-11381

user/index: ensure each user appears only once in participants list

Regardless of the number of enrolments, ensure we list a single entry
per user using DISTINCT. Much easier to manage than a GROUP BY.
This commit is contained in:
moodler 2007-10-02 06:18:30 +00:00
parent 165088f687
commit 5f2a203fa0

View File

@ -331,7 +331,7 @@
}
if ($context->id != $frontpagectx->id) {
$select = 'SELECT u.id, u.username, u.firstname, u.lastname,
$select = 'SELECT DISTINCT u.id, u.username, u.firstname, u.lastname,
u.email, u.city, u.country, u.picture,
u.lang, u.timezone, u.emailstop, u.maildisplay, u.imagealt,
COALESCE(ul.timeaccess, 0) AS lastaccess,
@ -340,7 +340,7 @@
ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel ';
$select .= $course->enrolperiod?', r.timeend ':'';
} else {
$select = 'SELECT u.id, u.username, u.firstname, u.lastname,
$select = 'SELECT DISTINCT u.id, u.username, u.firstname, u.lastname,
u.email, u.city, u.country, u.picture,
u.lang, u.timezone, u.emailstop, u.maildisplay, u.imagealt,
u.lastaccess,