mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
remove first_relearn_entries
This commit is contained in:
parent
f91dec44ee
commit
53dd619a04
1 changed files with 3 additions and 7 deletions
|
@ -260,15 +260,11 @@ pub(crate) fn single_card_revlog_to_items(
|
||||||
ignore_revlogs_before: TimestampMillis,
|
ignore_revlogs_before: TimestampMillis,
|
||||||
) -> Option<(Vec<FSRSItem>, bool, usize, Vec<RevlogEntry>)> {
|
) -> Option<(Vec<FSRSItem>, bool, usize, Vec<RevlogEntry>)> {
|
||||||
let mut first_of_last_learn_entries = None;
|
let mut first_of_last_learn_entries = None;
|
||||||
let mut first_relearn_entries = None;
|
|
||||||
let mut non_manual_entries = None;
|
let mut non_manual_entries = None;
|
||||||
let mut revlogs_complete = false;
|
let mut revlogs_complete = false;
|
||||||
for (index, entry) in entries.iter().enumerate().rev() {
|
for (index, entry) in entries.iter().enumerate().rev() {
|
||||||
if matches!(entry.button_chosen, 1..=4) {
|
if matches!(entry.button_chosen, 1..=4) {
|
||||||
non_manual_entries = Some(index);
|
non_manual_entries = Some(index);
|
||||||
if entry.review_kind == RevlogReviewKind::Relearning {
|
|
||||||
first_relearn_entries = Some(index);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if matches!(
|
if matches!(
|
||||||
(entry.review_kind, entry.button_chosen),
|
(entry.review_kind, entry.button_chosen),
|
||||||
|
@ -325,8 +321,8 @@ pub(crate) fn single_card_revlog_to_items(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(idx) = first_of_last_learn_entries.or(first_relearn_entries) {
|
if let Some(idx) = first_of_last_learn_entries {
|
||||||
// start from the (re)learning step
|
// start from the learning step
|
||||||
if idx > 0 {
|
if idx > 0 {
|
||||||
entries.drain(..idx);
|
entries.drain(..idx);
|
||||||
}
|
}
|
||||||
|
@ -334,7 +330,7 @@ pub(crate) fn single_card_revlog_to_items(
|
||||||
// when training, we ignore cards that don't have any learning steps
|
// when training, we ignore cards that don't have any learning steps
|
||||||
return None;
|
return None;
|
||||||
} else if let Some(idx) = non_manual_entries {
|
} else if let Some(idx) = non_manual_entries {
|
||||||
// if there are no (re)learning entries but there are non-manual entries,
|
// if there are no learning entries but there are non-manual entries,
|
||||||
// we ignore all entries before the first non-manual entry
|
// we ignore all entries before the first non-manual entry
|
||||||
if idx > 0 {
|
if idx > 0 {
|
||||||
entries.drain(..idx);
|
entries.drain(..idx);
|
||||||
|
|
Loading…
Reference in a new issue