Skip to content

Commit

Permalink
Update query for cards to reschedule in sync hook
Browse files Browse the repository at this point in the history
  • Loading branch information
user1823 committed Jun 8, 2024
1 parent 68dfe72 commit a0fbb98
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sync_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ def create_comparelog(local_rids: List[int]) -> None:

def review_cid_remote(local_rids: List[int]):
local_rid_string = ids2str(local_rids)
# exclude entries where ivl == lastIvl: they indicate a dynamic deck without rescheduling
# get cids of revlog entries that were not present in the collection before sync
# exclude manual entries and reviews done in filtered decks with rescheduling disabled
remote_reviewed_cids = [
cid
for cid in mw.col.db.list(
f"""SELECT DISTINCT cid
FROM revlog
WHERE id NOT IN {local_rid_string}
AND type < 3
AND ease > 0
AND (type < 3 OR factor != 0)
"""
) # type: 0=Learning, 1=Review, 2=relearn, 3=Relearning, 4=Manual
) # type: 0=learn, 1=review, 2=relearn, 3=filtered, 4=manual
]
return remote_reviewed_cids

Expand Down

0 comments on commit a0fbb98

Please sign in to comment.