Fix/first and latest review dates should only consider entries with a rating. (#4360)

* Fix/first and latest review dates should only only consider entries with a rating.

* Update rslib/src/stats/card.rs

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>

---------

Co-authored-by: user1823 <92206575+user1823@users.noreply.github.com>
This commit is contained in:
Jarrett Ye 2025-09-27 13:46:50 +08:00 committed by GitHub
parent 3a5a2b1afb
commit 03f3a005f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -76,8 +76,15 @@ impl Collection {
note_id: card.note_id.into(), note_id: card.note_id.into(),
deck: deck.human_name(), deck: deck.human_name(),
added: card.id.as_secs().0, added: card.id.as_secs().0,
first_review: revlog.first().map(|entry| entry.id.as_secs().0), first_review: revlog
latest_review: revlog.last().map(|entry| entry.id.as_secs().0), .iter()
.find(|entry| entry.has_rating())
.map(|entry| entry.id.as_secs().0),
// last_review_time is not used to ensure cram revlogs are included.
latest_review: revlog
.iter()
.rfind(|entry| entry.has_rating())
.map(|entry| entry.id.as_secs().0),
due_date: self.due_date(&card)?, due_date: self.due_date(&card)?,
due_position: self.position(&card), due_position: self.position(&card),
interval: card.interval, interval: card.interval,