Fix bug where last_created is incorectly set in the SyncToken.

This commit is contained in:
Michael Shavit 2020-01-25 23:46:50 -05:00
parent c0239a659c
commit 5027aeb3a0

View File

@ -130,7 +130,7 @@ def HandleSyncRequest():
changed_entries = ( changed_entries = (
db.session.query(db.Books) db.session.query(db.Books)
.join(db.Data) .join(db.Data)
.filter(func.datetime(db.Books.last_modified) != sync_token.books_last_modified) .filter(func.datetime(db.Books.last_modified) > sync_token.books_last_modified)
.filter(db.Data.format.in_(KOBO_FORMATS)) .filter(db.Data.format.in_(KOBO_FORMATS))
.filter(db.Books.id.notin_(archived_book_ids)) .filter(db.Books.id.notin_(archived_book_ids))
.all() .all()
@ -149,7 +149,7 @@ def HandleSyncRequest():
new_books_last_modified = max( new_books_last_modified = max(
book.last_modified, sync_token.books_last_modified book.last_modified, sync_token.books_last_modified
) )
new_books_last_created = max(book.timestamp, sync_token.books_last_modified) new_books_last_created = max(book.timestamp, sync_token.books_last_created)
sync_token.books_last_created = new_books_last_created sync_token.books_last_created = new_books_last_created
sync_token.books_last_modified = new_books_last_modified sync_token.books_last_modified = new_books_last_modified