Skip to content

Commit

Permalink
Sort comments by timeposted AND id to avoid random behat failures
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aolley committed Sep 20, 2017
1 parent a21284e commit a2d9dd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a2d9dd7

Please sign in to comment.