Merge branch 'MDL-54542-master-fixup' of https://github.com/FMCorz/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Thu, 19 May 2016 02:56:50 +0000 (10:56 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Thu, 19 May 2016 02:56:50 +0000 (10:56 +0800)
competency/classes/api.php

index f58a59a..004c8de 100644 (file)
@@ -2409,6 +2409,9 @@ class api {
         $sql .= " AND p.userid $insql";
         $params += $inparams;
 
+        // Order by last updated, seconded by ID to prevent random ordering.
+        $sql .= " ORDER BY p.timemodified DESC, p.id ASC";
+
         $plans = array();
         $records = $DB->get_recordset_sql($select . $sql, $params, $skip, $limit);
         foreach ($records as $record) {