mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
unbury when refreshing queues
While we already unbury when refreshing the deck list, if the user resumes study on a new day without refreshing the deck list, burying could end up being delayed. Possible fix for https://forums.ankiweb.net/t/buried-cards-in-ankimobile-beta-20081-3/14753/3
This commit is contained in:
parent
044d253306
commit
5f05eeb922
2 changed files with 5 additions and 4 deletions
|
@ -33,8 +33,7 @@ impl Collection {
|
|||
let last_unburied = self.get_last_unburied_day();
|
||||
let today = timing.days_elapsed;
|
||||
if last_unburied < today || (today + 7) < last_unburied {
|
||||
self.unbury_on_day_rollover()?;
|
||||
self.set_last_unburied_day(today)?;
|
||||
self.unbury_on_day_rollover(today)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -42,13 +41,14 @@ impl Collection {
|
|||
|
||||
/// Unbury cards from the previous day.
|
||||
/// Done automatically, and does not mark the cards as modified.
|
||||
fn unbury_on_day_rollover(&mut self) -> Result<()> {
|
||||
pub(crate) fn unbury_on_day_rollover(&mut self, today: u32) -> Result<()> {
|
||||
self.search_cards_into_table("is:buried", SortMode::NoOrder)?;
|
||||
self.storage.for_each_card_in_search(|mut card| {
|
||||
card.restore_queue_after_bury_or_suspend();
|
||||
self.storage.update_card(&card)
|
||||
})?;
|
||||
self.storage.clear_searched_cards_table()
|
||||
self.storage.clear_searched_cards_table()?;
|
||||
self.set_last_unburied_day(today)
|
||||
}
|
||||
|
||||
/// Unsuspend/unbury cards in search table, and clear it.
|
||||
|
|
|
@ -248,6 +248,7 @@ impl Collection {
|
|||
.unwrap_or(false);
|
||||
if day_rolled_over {
|
||||
self.discard_undo_and_study_queues();
|
||||
self.unbury_on_day_rollover(timing.days_elapsed)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue