mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Use the id for ordering as well
This commit is contained in:
parent
4fa7648de4
commit
eda40df3a9
@ -57,7 +57,7 @@ class LastReadCache:
|
|||||||
self.execute(
|
self.execute(
|
||||||
'INSERT OR REPLACE INTO last_read_positions(library_id,book,format,user,cfi,epoch,pos_frac,tooltip) VALUES (?,?,?,?,?,?,?,?)',
|
'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))
|
(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:
|
if len(items) > self.limit:
|
||||||
limit_id = items[self.limit][0]
|
limit_id = items[self.limit][0]
|
||||||
self.execute('DELETE FROM last_read_positions WHERE user=? AND id <= ?', (user, limit_id))
|
self.execute('DELETE FROM last_read_positions WHERE user=? AND id <= ?', (user, limit_id))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user