MDL-28015 workshop - fixed unique list of columns in ORDER BY clause
MSSQL requires that the columns in the ORDER BY clause list must be unique. The patch populates the list of fields by combining an array of explicit sort definition with an array of implicit (default) sort definition.
This commit is contained in:
@@ -1342,7 +1342,12 @@ class workshop {
|
||||
list($participantids, $params) = $DB->get_in_or_equal(array_keys($participants), SQL_PARAMS_NAMED);
|
||||
$params['workshopid1'] = $this->id;
|
||||
$params['workshopid2'] = $this->id;
|
||||
$sqlsort = $sortby . ' ' . $sorthow . ',u.lastname,u.firstname,u.id';
|
||||
$sqlsort = array();
|
||||
$sqlsortfields = array($sortby => $sorthow) + array('lastname' => 'ASC', 'firstname' => 'ASC', 'u.id' => 'ASC');
|
||||
foreach ($sqlsortfields as $sqlsortfieldname => $sqlsortfieldhow) {
|
||||
$sqlsort[] = $sqlsortfieldname . ' ' . $sqlsortfieldhow;
|
||||
}
|
||||
$sqlsort = implode(',', $sqlsort);
|
||||
$sql = "SELECT u.id AS userid,u.firstname,u.lastname,u.picture,u.imagealt,u.email,
|
||||
s.title AS submissiontitle, s.grade AS submissiongrade, ag.gradinggrade
|
||||
FROM {user} u
|
||||
|
||||
Reference in New Issue
Block a user