Skip to content

Commit

Permalink
MDL-69142 tool_cohortroles: fix table ordering by role name.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulholden committed Dec 16, 2024
1 parent ce0193f commit 544fbd7
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected function define_table_configs() {
* @return array containing sql to use and an array of params.
*/
protected function get_sql_and_params($count = false) {
$fields = 'uca.id, uca.cohortid, uca.userid, uca.roleid, ';
$fields = 'uca.id, uca.cohortid, uca.userid, uca.roleid, r.shortname AS rolename, ';
$fields .= 'c.name as cohortname, c.idnumber as cohortidnumber, c.contextid as cohortcontextid, ';
$fields .= 'c.visible as cohortvisible, c.description as cohortdescription, c.theme as cohorttheme';

Expand All @@ -193,6 +193,7 @@ protected function get_sql_and_params($count = false) {
$sql = "SELECT $select
FROM {tool_cohortroles} uca
JOIN {user} u ON u.id = uca.userid
JOIN {role} r ON r.id = uca.roleid
JOIN {cohort} c ON c.id = uca.cohortid";

// Check if any additional filtering is required.
Expand Down

0 comments on commit 544fbd7

Please sign in to comment.