Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update query for cards to reschedule in sync hook #420

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading