mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 14:03:55 -05:00
Refactor desired retention logic in Collection implementation
Updated the logic for retrieving deck-specific desired retention in both `memory_state.rs` and `mod.rs` to handle cases where the deck's normal state may not be available. This change ensures that the default configuration is used when necessary, improving the robustness of the retention handling.
This commit is contained in:
parent
eef199830e
commit
9d7dc2350f
2 changed files with 8 additions and 4 deletions
|
|
@ -447,8 +447,10 @@ impl Collection {
|
||||||
|
|
||||||
// Get deck-specific desired retention if available, otherwise use config
|
// Get deck-specific desired retention if available, otherwise use config
|
||||||
// default
|
// default
|
||||||
let desired_retention = if let Some(deck_dr) = deck.normal()?.desired_retention {
|
let desired_retention = if let Ok(normal_deck) = deck.normal() {
|
||||||
deck_dr
|
normal_deck
|
||||||
|
.desired_retention
|
||||||
|
.unwrap_or(config.inner.desired_retention)
|
||||||
} else {
|
} else {
|
||||||
config.inner.desired_retention
|
config.inner.desired_retention
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -208,8 +208,10 @@ impl Collection {
|
||||||
|
|
||||||
// Get deck-specific desired retention if available, otherwise use config
|
// Get deck-specific desired retention if available, otherwise use config
|
||||||
// default
|
// default
|
||||||
let desired_retention = if let Some(deck_dr) = deck.normal()?.desired_retention {
|
let desired_retention = if let Ok(normal_deck) = deck.normal() {
|
||||||
deck_dr
|
normal_deck
|
||||||
|
.desired_retention
|
||||||
|
.unwrap_or(config.inner.desired_retention)
|
||||||
} else {
|
} else {
|
||||||
config.inner.desired_retention
|
config.inner.desired_retention
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue