Fix: Newly due learning cards incorrectly shown as buried in deck overview#4752
Open
user1823 wants to merge 2 commits intoankitects:mainfrom
Open
Fix: Newly due learning cards incorrectly shown as buried in deck overview#4752user1823 wants to merge 2 commits intoankitects:mainfrom
user1823 wants to merge 2 commits intoankitects:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue (required)
Fixes #4263
Supersedes #4271
Summary / motivation (required)
Anki caches the learning cutoff to prevent a newly-due learning card from appearing instead of the current card when the user edits a card from the reviewer and then returns to study. (Ref: #4271 (comment))
This is a problem because
counts()uses this cached cutoff to calculate the learning card counts, causing a mismatch betweendeck_node.learn_count(which always uses the up-to-date cut-off) andcounts[1](which uses the cached cutoff). This mismatch causes the deck overview to incorrectly show these newly due learning cards as buried.This PR adds a
newly_due_learning_count()helper that counts intraday learning cards that have become due since the last cutoff update.counts()now includes these cards in the returned learning count without advancing the current_learning_cutoff, so the order in which cards are shown during a study session is unaffected.Steps to reproduce (required, use N/A if not applicable)
How to test (required)
Checklist (minimum)
./ninja checkor an equivalent relevant check locally.Details
Before / after behavior (optional)
Risk / compatibility / migration (optional)
UI evidence (required for visual changes; otherwise N/A)
Scope