mirror of
https://github.com/ankitects/anki.git
synced 2025-12-30 23:32:57 -05:00
Fix underflow of learning count (#1444)
`counts.learning` includes interday learning cards, so it is not
suitable to determine how many cards from the (intraday!) learning queue
are already included in the learning count when updating it.
(cherry picked from commit 56d8402f89)
This commit is contained in:
parent
a6951833cf
commit
86c56f9eb0
1 changed files with 4 additions and 3 deletions
|
|
@ -40,13 +40,14 @@ impl CardQueues {
|
|||
learning_count: self.counts.learning,
|
||||
learning_cutoff: self.current_learning_cutoff,
|
||||
};
|
||||
let last_ahead_cutoff = self.current_learn_ahead_cutoff();
|
||||
self.current_learning_cutoff = TimestampSecs::now();
|
||||
let ahead_cutoff = self.current_learn_ahead_cutoff();
|
||||
let new_ahead_cutoff = self.current_learn_ahead_cutoff();
|
||||
let new_learning_cards = self
|
||||
.intraday_learning
|
||||
.iter()
|
||||
.skip(self.counts.learning)
|
||||
.take_while(|e| e.due <= ahead_cutoff)
|
||||
.skip_while(|e| e.due <= last_ahead_cutoff)
|
||||
.take_while(|e| e.due <= new_ahead_cutoff)
|
||||
.count();
|
||||
self.counts.learning += new_learning_cards;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue