-
Bug
-
Resolution: Not a bug
-
Major
-
None
-
3.7
-
MOODLE_37_STABLE
There is a problem with PostgreSQL (probably other DBs also) that it will not grantee consistent sort no matter what LIMIT/OFFSET combination is used. This can cause problems in course participants list if there are students with the same name and they are needed to be split on two pages. It can cause the same student to be shown as last entry on first page and then first entry on second page.
This problem is bit hard to reproduce as it's a problem with PostgreSQL. In attached pics it is visible directly from SQL query results (removed user info because of user privacy).
Fix is very simple, just add sort by ID as second parameter in user/lib.php in function user_get_participants:
function user_get_participants($courseid, $groupid = 0, $accesssince, $roleid, $enrolid = 0, $statusid, $search,function user_get_participants($courseid, $groupid = 0, $accesssince, $roleid, $enrolid = 0, $statusid, $search, $additionalwhere = '', $additionalparams = array(), $sort = '', $limitfrom = 0, $limitnum = 0) {
|
global $DB;
|
list($select, $from, $where, $params) = user_get_participants_sql($courseid, $groupid, $accesssince, $roleid, $enrolid,
|
$statusid, $search, $additionalwhere, $additionalparams);
|
|
if($sort != ''){
|
$sort .= ', id';
|
}
|
return $DB->get_recordset_sql("$select $from $where $sort", $params, $limitfrom, $limitnum);
|
}
|
In screenshots take not of id 75462 and where it appears of first 3 pics depending on LIMIT/OFFSET combinations. With sort only by firstname there is no way to list user with id 80380 when listing pages.