From a2d9dd700c961d2e92a2dcdd52950ca3c7deb5a8 Mon Sep 17 00:00:00 2001 From: Adam Olley Date: Wed, 20 Sep 2017 10:01:56 +0930 Subject: [PATCH] Sort comments by timeposted AND id to avoid random behat failures Without this change, the order comments are displayed in can be random if they're posted at the exact same second (as generally happens in behat testing). This causes a problem for the behat test when it just goes to delete the second comment on the page, assuming they're in order. This likely doesn't affect mysql, but definitely does affect pgsql. --- locallib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locallib.php b/locallib.php index 75f26cb..bb8f105 100644 --- a/locallib.php +++ b/locallib.php @@ -707,7 +707,7 @@ function oublog_get_posts($oublog, $context, $offset = 0, $cm, $groupid, $indivi FROM {oublog_comments} c LEFT JOIN {user} u ON c.userid = u.id WHERE c.postid IN (".implode(",", $postids).") AND c.deletedby IS NULL - ORDER BY c.timeposted ASC "; + ORDER BY c.timeposted ASC, c.id ASC "; $rs = $DB->get_recordset_sql($sql); foreach ($rs as $comment) {