matthayes / anki_progress_stats

Anki plugin that adds progress stats for learned and matured cards
https://ankiweb.net/shared/info/266436365
Apache License 2.0
27 stars 6 forks source link

Graph not displaying correct number of learned cards #30

Open DrSchwifty opened 3 years ago

DrSchwifty commented 3 years ago

I love this add-on and have been using it for a while now, but recently I've noticed on Anki 2.1.26 the graph isn't showing the correct number of cards learned. For instance if I have 1,000 unsuspended cards in a deck and limit it to learning 100 cards per day and I do those 100 cards the graph only displays that I've done ~75 cards. I think its not counting the cards that I hit easy on the first time I see the card, but I'm not sure.

matthayes commented 3 years ago

Sorry I forgot to respond to this.

I think its not counting the cards that I hit easy on the first time I see the card, but I'm not sure.

This is a useful observation. I wonder if there is a bug here. I'm going to do some testing and will get back to you.

matthayes commented 3 years ago

I reviewed the code and did some testing. I looked at some cards in the data where I had hit easy on the first time seeing it. There could still be an issue, but the logic in the code seems correct to me based on what I'm observing in the data. Maybe there is some difference with the review history in Anki 2.1.26. When you learn the 100 cards, are you completing all the learning steps for the cards as well? If the card is not considered learned until it completes all the learning steps. If you're willing to share your deck with me I could check the review history to see if there is an issue.

In case you're curious about what I was looking into, there is a piece of code (below) that checks whether one of the reviews in the queried reviews for a card is the first time it was learned. I confirmed for my data that when if I hit easy on the first time seeing a card the new interval is positive and the last interval is negative.

    for review in card_reviews.reviews:
        if review.lastIvl < 0 and review.ivl > 0 and review.id == review.first_learned_id:
            return True

    return False

https://github.com/matthayes/anki_progress_stats/blob/master/progress_stats/compute.py#L196