Sort positions by id in case time is constant

This commit is contained in:
Bartek Fabiszewski 2017-05-05 19:24:03 +02:00
parent 34e93aed6c
commit 75186487bd

View File

@ -158,7 +158,7 @@
LEFT JOIN `" . self::$db->table('users') . "` u ON (p.user_id = u.id) 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) LEFT JOIN `" . self::$db->table('tracks') . "` t ON (p.track_id = t.id)
$where $where
ORDER BY p.time DESC LIMIT 1"; ORDER BY p.time, p.id DESC LIMIT 1";
$this->loadWithQuery($query, $params); $this->loadWithQuery($query, $params);
return $this; return $this;
} }
@ -190,7 +190,7 @@
LEFT JOIN `" . self::$db->table('users') . "` u ON (p.user_id = u.id) 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) LEFT JOIN `" . self::$db->table('tracks') . "` t ON (p.track_id = t.id)
$where $where
ORDER BY p.time"; ORDER BY p.time, p.id";
$result = self::$db->query($query); $result = self::$db->query($query);
if ($result === false) { if ($result === false) {
return false; return false;