Do not bury suspended cards (#1447)

* Skip burying for suspended cards

* Inform about number of buried cards
This commit is contained in:
RumovZ 2021-10-23 03:04:26 +02:00 committed by GitHub
parent 1c9b5a2e83
commit 3cdb3d72c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 28 deletions

View File

@ -6,9 +6,13 @@ studying-buried-siblings = Buried Siblings
studying-bury = Bury
studying-bury-card = Bury Card
studying-bury-note = Bury Note
studying-card-buried = Card buried.
studying-card-suspended = Card suspended.
studying-card-was-a-leech = Card was a leech.
studying-cards-buried =
{ $count ->
[one] { $count } card buried.
*[other] { $count } cards buried.
}
studying-cards-will-be-automatically-returned-to = Cards will be automatically returned to their original decks after you review them.
studying-continue = Continue
studying-delete-note = Delete Note
@ -25,7 +29,6 @@ studying-manually-buried-cards = Manually Buried Cards
studying-mark-note = Mark Note
studying-more = More
studying-no-cards-are-due-yet = No cards are due yet.
studying-note-buried = Note buried.
studying-note-suspended = Note suspended.
studying-pause-audio = Pause Audio
studying-please-run-toolsempty-cards = Please run Tools>Empty Cards

View File

@ -1027,16 +1027,14 @@ time = %(time)d;
).success(lambda _: tooltip(tr.studying_card_suspended())).run_in_background()
def bury_current_note(self) -> None:
bury_notes(
parent=self.mw,
note_ids=[self.card.nid],
).success(lambda _: tooltip(tr.studying_note_buried())).run_in_background()
bury_notes(parent=self.mw, note_ids=[self.card.nid],).success(
lambda res: tooltip(tr.studying_cards_buried(count=res.count))
).run_in_background()
def bury_current_card(self) -> None:
bury_cards(
parent=self.mw,
card_ids=[self.card.id],
).success(lambda _: tooltip(tr.studying_card_buried())).run_in_background()
bury_cards(parent=self.mw, card_ids=[self.card.id],).success(
lambda res: tooltip(tr.studying_cards_buried(count=res.count))
).run_in_background()
def delete_current_note(self) -> None:
# need to check state because the shortcut is global to the main

View File

@ -92,9 +92,6 @@ impl Collection {
let mut count = 0;
let usn = self.usn()?;
let sched = self.scheduler_version();
for original in self.storage.all_searched_cards()? {
let mut card = original.clone();
let desired_queue = match mode {
BuryOrSuspendMode::Suspend => CardQueue::Suspended,
BuryOrSuspendMode::BurySched => CardQueue::SchedBuried,
@ -107,7 +104,12 @@ impl Collection {
}
}
};
for original in self.storage.all_searched_cards()? {
let mut card = original.clone();
if card.queue != desired_queue {
// do not bury suspended cards as that would unsuspend them
if card.queue != CardQueue::Suspended {
if sched == SchedulerVersion::V1 {
card.remove_from_filtered_deck_restoring_queue(sched);
card.remove_from_learning();
@ -117,6 +119,7 @@ impl Collection {
self.update_card_inner(&mut card, original, usn)?;
}
}
}
self.storage.clear_searched_cards_table()?;