mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 14:03:55 -05:00
Document the purpose of storing dr and decay in card
This commit is contained in:
parent
a4c95f5fbd
commit
55f3c8cd95
1 changed files with 5 additions and 5 deletions
|
|
@ -105,10 +105,11 @@ impl Collection {
|
||||||
progress.update(true, |state| state.current_cards = idx as u32 + 1)?;
|
progress.update(true, |state| state.current_cards = idx as u32 + 1)?;
|
||||||
let mut card = self.storage.get_card(card_id)?.or_not_found(card_id)?;
|
let mut card = self.storage.get_card(card_id)?.or_not_found(card_id)?;
|
||||||
let original = card.clone();
|
let original = card.clone();
|
||||||
if let (Some(req), Some(item)) = (&req, item) {
|
// store decay and desired retention in the card so that add-ons, card info and Stats don't need to access the deck config
|
||||||
card.set_memory_state(&fsrs, Some(item), historical_retention.unwrap())?;
|
|
||||||
card.desired_retention = desired_retention;
|
card.desired_retention = desired_retention;
|
||||||
card.decay = decay;
|
card.decay = decay;
|
||||||
|
if let (Some(req), Some(item)) = (&req, item) {
|
||||||
|
card.set_memory_state(&fsrs, Some(item), historical_retention.unwrap())?;
|
||||||
// if rescheduling
|
// if rescheduling
|
||||||
if let Some(reviews) = &last_revlog_info {
|
if let Some(reviews) = &last_revlog_info {
|
||||||
// and we have a last review time for the card
|
// and we have a last review time for the card
|
||||||
|
|
@ -128,7 +129,7 @@ impl Collection {
|
||||||
let original_interval = card.interval;
|
let original_interval = card.interval;
|
||||||
let interval = fsrs.next_interval(
|
let interval = fsrs.next_interval(
|
||||||
Some(state.stability),
|
Some(state.stability),
|
||||||
card.desired_retention.unwrap(),
|
desired_retention,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
card.interval = rescheduler
|
card.interval = rescheduler
|
||||||
|
|
@ -175,7 +176,6 @@ impl Collection {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
card.memory_state = None;
|
card.memory_state = None;
|
||||||
card.desired_retention = None;
|
|
||||||
}
|
}
|
||||||
self.update_card_inner(&mut card, original, usn)?;
|
self.update_card_inner(&mut card, original, usn)?;
|
||||||
}
|
}
|
||||||
|
|
@ -214,7 +214,7 @@ impl Collection {
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
card.memory_state = None;
|
card.memory_state = None;
|
||||||
card.desired_retention = None;
|
card.desired_retention = desired_retention;
|
||||||
Ok(ComputeMemoryStateResponse {
|
Ok(ComputeMemoryStateResponse {
|
||||||
state: None,
|
state: None,
|
||||||
desired_retention,
|
desired_retention,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue