From 75186487bd18e979c46c3795f9e63056f4cf9f87 Mon Sep 17 00:00:00 2001 From: Bartek Fabiszewski Date: Fri, 5 May 2017 19:24:03 +0200 Subject: [PATCH] Sort positions by id in case time is constant --- helpers/position.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helpers/position.php b/helpers/position.php index 30a3d11..be8bb52 100644 --- a/helpers/position.php +++ b/helpers/position.php @@ -158,7 +158,7 @@ LEFT JOIN `" . self::$db->table('users') . "` u ON (p.user_id = u.id) LEFT JOIN `" . self::$db->table('tracks') . "` t ON (p.track_id = t.id) $where - ORDER BY p.time DESC LIMIT 1"; + ORDER BY p.time, p.id DESC LIMIT 1"; $this->loadWithQuery($query, $params); return $this; } @@ -190,7 +190,7 @@ LEFT JOIN `" . self::$db->table('users') . "` u ON (p.user_id = u.id) LEFT JOIN `" . self::$db->table('tracks') . "` t ON (p.track_id = t.id) $where - ORDER BY p.time"; + ORDER BY p.time, p.id"; $result = self::$db->query($query); if ($result === false) { return false;