From d3020ab4b1d897b9eb6511f9191812daf952f828 Mon Sep 17 00:00:00 2001 From: RisingOrange Date: Wed, 3 Jan 2024 00:54:58 +0100 Subject: [PATCH] fix: Exclude rescheduling entries from review data --- ankihub/main/review_data.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ankihub/main/review_data.py b/ankihub/main/review_data.py index 693934260..dea0cdeed 100644 --- a/ankihub/main/review_data.py +++ b/ankihub/main/review_data.py @@ -3,6 +3,7 @@ from typing import Optional, Tuple import aqt +from anki import consts as anki_consts from .. import LOGGER from ..addon_ankihub_client import AddonAnkiHubClient as AnkiHubClient @@ -56,7 +57,9 @@ def _get_review_count_for_ah_deck_since(ah_did: uuid.UUID, since: datetime) -> i SELECT COUNT(*) FROM revlog as r JOIN cards as c ON r.cid = c.id - WHERE r.id > ? AND c.nid IN ({','.join(map(str, anki_nids))}) + WHERE r.id > ? + AND r.type != {anki_consts.REVLOG_RESCHED} + AND c.nid IN ({','.join(map(str, anki_nids))}) """, timestamp_ms, ) @@ -73,7 +76,8 @@ def _get_first_and_last_review_datetime_for_ah_deck( SELECT MIN(r.id), MAX(r.id) FROM revlog as r JOIN cards as c ON r.cid = c.id - WHERE c.nid IN ({','.join(map(str, anki_nids))}) + WHERE r.type != {anki_consts.REVLOG_RESCHED} + AND c.nid IN ({','.join(map(str, anki_nids))}) """, ) if row[0] is None: