Skip to content

Commit

Permalink
Revert "Adding conditional CAST when ordering by name"
Browse files Browse the repository at this point in the history
This reverts commit 1df6832.
  • Loading branch information
ndunand committed Nov 4, 2024
1 parent e7bc753 commit 77f2839
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -848,14 +848,12 @@ function choicegroup_get_choicegroup($choicegroupid) {
$grpfilter = "AND grp_o.groupid = :groupid";
}

$castorderby = ($sortcolumn == 'name') ? "CAST(REGEXP_SUBSTR($sortcolumn, '[0-9]+') AS UNSIGNED)," : "";

$sql = "SELECT grp_m.id grpmemberid, grp_m.userid, grp_o.id, grp_o.groupid, grp_o.maxanswers
FROM {groups} grp
INNER JOIN {choicegroup_options} grp_o on grp.id = grp_o.groupid
LEFT JOIN {groups_members} grp_m on grp_m.groupid = grp_o.groupid
WHERE grp_o.choicegroupid = :choicegroupid $grpfilter
ORDER BY $castorderby $sortcolumn ASC";
ORDER BY $sortcolumn ASC";

$rs = $DB->get_recordset_sql($sql, $params);

Expand Down

0 comments on commit 77f2839

Please sign in to comment.