Skip to content

Commit

Permalink
fix: Exclude rescheduling entries from review data
Browse files Browse the repository at this point in the history
  • Loading branch information
RisingOrange committed Jan 2, 2024
1 parent 648c923 commit d3020ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ankihub/main/review_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)
Expand All @@ -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:
Expand Down

0 comments on commit d3020ab

Please sign in to comment.