Fix custom study applying previously-selected limit

extend_limits() mutates deck, so we need to re-fetch it.

Closes #1829
This commit is contained in:
Damien Elmes 2022-05-02 20:57:29 +10:00
parent 1e02980133
commit d2ec004ac3

View File

@ -86,6 +86,7 @@ impl Collection {
let today = self.current_due_day(0)?;
self.extend_limits(today, self.usn()?, deck.id, delta, 0)?;
if delta > 0 {
deck = self.storage.get_deck(deck.id)?.ok_or(AnkiError::NotFound)?;
let original = deck.clone();
deck.normal_mut()?.extend_new = delta as u32;
self.update_deck_inner(&mut deck, original, self.usn()?)?;
@ -96,6 +97,7 @@ impl Collection {
let today = self.current_due_day(0)?;
self.extend_limits(today, self.usn()?, deck.id, 0, delta)?;
if delta > 0 {
deck = self.storage.get_deck(deck.id)?.ok_or(AnkiError::NotFound)?;
let original = deck.clone();
deck.normal_mut()?.extend_review = delta as u32;
self.update_deck_inner(&mut deck, original, self.usn()?)?;