mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
Add is_reset method to RevlogEntry and update scheduling logic
This commit introduces the `is_reset` method to the `RevlogEntry` struct, which identifies entries representing reset operations. Additionally, the scheduling logic in `memory_state.rs` and `params.rs` has been updated to utilize this new method, ensuring that reset entries are handled correctly during review scheduling.
This commit is contained in:
parent
76fa585919
commit
bd91d22aac
3 changed files with 10 additions and 4 deletions
|
@ -85,6 +85,13 @@ impl RevlogEntry {
|
|||
.unwrap()
|
||||
}
|
||||
|
||||
/// Returns true if this entry represents a reset operation.
|
||||
/// These entries are created when a card is reset using
|
||||
/// [`Collection::reschedule_cards_as_new`].
|
||||
pub(crate) fn is_reset(&self) -> bool {
|
||||
self.review_kind == RevlogReviewKind::Manual && self.ease_factor == 0
|
||||
}
|
||||
|
||||
/// Returns true if the review entry is not manually rescheduled and not
|
||||
/// cramming. Used to filter out entries that shouldn't be considered
|
||||
/// for statistics and scheduling.
|
||||
|
|
|
@ -325,6 +325,8 @@ pub(crate) fn get_last_revlog_info(revlogs: &[RevlogEntry]) -> HashMap<CardId, L
|
|||
for e in group.into_iter() {
|
||||
if e.has_rating_and_affects_scheduling() {
|
||||
last_reviewed_at = Some(e.id.as_secs());
|
||||
} else if e.is_reset() {
|
||||
last_reviewed_at = None;
|
||||
}
|
||||
}
|
||||
out.insert(card_id, LastRevlogInfo { last_reviewed_at });
|
||||
|
|
|
@ -409,10 +409,7 @@ pub(crate) fn reviews_for_fsrs(
|
|||
if user_graded && entry.review_kind == RevlogReviewKind::Learning {
|
||||
first_of_last_learn_entries = Some(index);
|
||||
revlogs_complete = true;
|
||||
} else if matches!(
|
||||
(entry.review_kind, entry.ease_factor),
|
||||
(RevlogReviewKind::Manual, 0)
|
||||
) {
|
||||
} else if entry.is_reset() {
|
||||
// Ignore entries prior to a `Reset` if a learning step has come after,
|
||||
// but consider revlogs complete.
|
||||
if first_of_last_learn_entries.is_some() {
|
||||
|
|
Loading…
Reference in a new issue