mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Add desired_retention field to NormalDeckSchema11 (#4292)
* Add desired_retention field to NormalDeckSchema11 * pass ci
This commit is contained in:
parent
01b825f7c6
commit
4ac80061ca
1 changed files with 7 additions and 2 deletions
|
@ -135,6 +135,8 @@ pub struct NormalDeckSchema11 {
|
|||
review_limit_today: Option<DayLimit>,
|
||||
#[serde(default, deserialize_with = "default_on_invalid")]
|
||||
new_limit_today: Option<DayLimit>,
|
||||
#[serde(default, deserialize_with = "default_on_invalid")]
|
||||
desired_retention: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, PartialEq, Debug, Clone)]
|
||||
|
@ -249,6 +251,7 @@ impl Default for NormalDeckSchema11 {
|
|||
new_limit: None,
|
||||
review_limit_today: None,
|
||||
new_limit_today: None,
|
||||
desired_retention: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -325,7 +328,7 @@ impl From<NormalDeckSchema11> for NormalDeck {
|
|||
new_limit: deck.new_limit,
|
||||
review_limit_today: deck.review_limit_today,
|
||||
new_limit_today: deck.new_limit_today,
|
||||
desired_retention: None,
|
||||
desired_retention: deck.desired_retention.map(|v| v as f32 / 100.0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -367,6 +370,7 @@ impl From<Deck> for DeckSchema11 {
|
|||
new_limit: norm.new_limit,
|
||||
review_limit_today: norm.review_limit_today,
|
||||
new_limit_today: norm.new_limit_today,
|
||||
desired_retention: norm.desired_retention.map(|v| (v * 100.0) as u32),
|
||||
common: deck.into(),
|
||||
}),
|
||||
DeckKind::Filtered(ref filt) => DeckSchema11::Filtered(FilteredDeckSchema11 {
|
||||
|
@ -431,7 +435,8 @@ static RESERVED_DECK_KEYS: Set<&'static str> = phf_set! {
|
|||
"browserCollapsed",
|
||||
"extendRev",
|
||||
"id",
|
||||
"collapsed"
|
||||
"collapsed",
|
||||
"desiredRetention",
|
||||
};
|
||||
|
||||
impl From<&Deck> for DeckTodaySchema11 {
|
||||
|
|
Loading…
Reference in a new issue