From eda40df3a9ce91dac8f74d66bf0fd50afe6924cd Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 15 Dec 2022 19:58:41 +0530 Subject: [PATCH] Use the id for ordering as well --- src/calibre/srv/last_read.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/srv/last_read.py b/src/calibre/srv/last_read.py index 44230b6c6f..fc30af9527 100644 --- a/src/calibre/srv/last_read.py +++ b/src/calibre/srv/last_read.py @@ -57,7 +57,7 @@ class LastReadCache: self.execute( 'INSERT OR REPLACE INTO last_read_positions(library_id,book,format,user,cfi,epoch,pos_frac,tooltip) VALUES (?,?,?,?,?,?,?,?)', (library_id, book_id, fmt, user, cfi, epoch, pos_frac, tooltip)) - items = tuple(self.get('SELECT id FROM last_read_positions WHERE user=? ORDER BY epoch DESC', (user,), all=True)) + items = tuple(self.get('SELECT id FROM last_read_positions WHERE user=? ORDER BY id DESC', (user,), all=True)) if len(items) > self.limit: limit_id = items[self.limit][0] self.execute('DELETE FROM last_read_positions WHERE user=? AND id <= ?', (user, limit_id))