|
|
|
@ -297,7 +297,8 @@ def HandleSyncRequest():
|
|
|
|
|
|
|
|
|
|
changed_reading_states = changed_reading_states.filter(
|
|
|
|
|
and_(ub.KoboReadingState.user_id == current_user.id,
|
|
|
|
|
ub.KoboReadingState.book_id.notin_(reading_states_in_new_entitlements)))
|
|
|
|
|
ub.KoboReadingState.book_id.notin_(reading_states_in_new_entitlements)))\
|
|
|
|
|
.order_by(ub.KoboReadingState.last_modified)
|
|
|
|
|
cont_sync |= bool(changed_reading_states.count() > SYNC_ITEM_LIMIT)
|
|
|
|
|
for kobo_reading_state in changed_reading_states.limit(SYNC_ITEM_LIMIT).all():
|
|
|
|
|
book = calibre_db.session.query(db.Books).filter(db.Books.id == kobo_reading_state.book_id).one_or_none()
|
|
|
|
@ -849,7 +850,7 @@ def get_ub_read_status(kobo_read_status):
|
|
|
|
|
|
|
|
|
|
def get_or_create_reading_state(book_id):
|
|
|
|
|
book_read = ub.session.query(ub.ReadBook).filter(ub.ReadBook.book_id == book_id,
|
|
|
|
|
ub.ReadBook.user_id == current_user.id).one_or_none()
|
|
|
|
|
ub.ReadBook.user_id == int(current_user.id)).one_or_none()
|
|
|
|
|
if not book_read:
|
|
|
|
|
book_read = ub.ReadBook(user_id=current_user.id, book_id=book_id)
|
|
|
|
|
if not book_read.kobo_reading_state:
|
|
|
|
|