Treat cards with no reps like new cards
https://github.com/open-spaced-repetition/fsrs4anki/issues/540#issuecomment-1837780217
This commit is contained in:
parent
96ae3a5d63
commit
86aafa74a6
@ -166,7 +166,7 @@ impl Card {
|
|||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let memory_state = if let Some(i) = item {
|
let memory_state = if let Some(i) = item {
|
||||||
Some(fsrs.memory_state(i.item, i.starting_state)?)
|
Some(fsrs.memory_state(i.item, i.starting_state)?)
|
||||||
} else if self.ctype == CardType::New || self.interval == 0 {
|
} else if self.ctype == CardType::New || self.interval == 0 || self.reps == 0 {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
// no valid revlog entries; infer state from current card state
|
// no valid revlog entries; infer state from current card state
|
||||||
@ -345,7 +345,10 @@ mod tests {
|
|||||||
difficulty: 4.46429
|
difficulty: 4.46429
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
let mut card = Card::default();
|
let mut card = Card {
|
||||||
|
reps: 1,
|
||||||
|
..Default::default()
|
||||||
|
};
|
||||||
card.set_memory_state(&fsrs, Some(item), 0.9)?;
|
card.set_memory_state(&fsrs, Some(item), 0.9)?;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
card.memory_state,
|
card.memory_state,
|
||||||
@ -390,6 +393,7 @@ mod tests {
|
|||||||
ctype: CardType::Review,
|
ctype: CardType::Review,
|
||||||
interval: 100,
|
interval: 100,
|
||||||
ease_factor: 1300,
|
ease_factor: 1300,
|
||||||
|
reps: 1,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
card.set_memory_state(&FSRS::new(Some(&[])).unwrap(), None, 0.9)?;
|
card.set_memory_state(&FSRS::new(Some(&[])).unwrap(), None, 0.9)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user