mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-54997 competencies: Fix random unit test fail
Sorting on timecreated is not unique enough to guarantee a predictable ordering.
This commit is contained in:
parent
da880d320c
commit
e824cd502d
@ -4152,7 +4152,7 @@ class api {
|
||||
* @param int $limit Number of records to return.
|
||||
* @return \core_competency\evidence[]
|
||||
*/
|
||||
public static function list_evidence_in_course($userid = 0, $courseid = 0, $competencyid = 0, $sort = 'timecreated',
|
||||
public static function list_evidence_in_course($userid = 0, $courseid = 0, $competencyid = 0, $sort = 'timecreated, id',
|
||||
$order = 'DESC', $skip = 0, $limit = 0) {
|
||||
static::require_enabled();
|
||||
|
||||
|
@ -296,7 +296,12 @@ class evidence extends persistent {
|
||||
*
|
||||
* @return \core_competency\persistent[]
|
||||
*/
|
||||
public static function get_records_for_usercompetency($usercompetencyid, \context $context, $sort = '', $order = 'ASC', $skip = 0, $limit = 0) {
|
||||
public static function get_records_for_usercompetency($usercompetencyid,
|
||||
\context $context,
|
||||
$sort = '',
|
||||
$order = 'ASC',
|
||||
$skip = 0,
|
||||
$limit = 0) {
|
||||
global $DB;
|
||||
|
||||
$params = array(
|
||||
@ -306,7 +311,9 @@ class evidence extends persistent {
|
||||
);
|
||||
|
||||
if (!empty($sort)) {
|
||||
$sort = ' ORDER BY e.' . $sort . ' ' . $order;
|
||||
$sortcolumns = explode(',', $sort);
|
||||
$sortcolumns = array_map('trim', $sortcolumns);
|
||||
$sort = ' ORDER BY e.' . implode(', e.', $sortcolumns) . ' ' . $order;
|
||||
}
|
||||
|
||||
$sql = 'SELECT e.*
|
||||
|
Loading…
x
Reference in New Issue
Block a user