Skip to content

Commit

Permalink
Update query for cards to reschedule in sync hook (#420)
Browse files Browse the repository at this point in the history
Co-authored-by: Jarrett Ye <[email protected]>
  • Loading branch information
user1823 and L-M-Sherlock committed Jun 11, 2024
1 parent 68dfe72 commit 18e9ec3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sync_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ def create_comparelog(local_rids: List[int]) -> None:


def review_cid_remote(local_rids: List[int]):
config = Config()
config.load()
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
{"" if config.auto_disperse_after_reschedule else "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 18e9ec3

Please sign in to comment.