Do not bury suspended cards (#1447)
* Skip burying for suspended cards * Inform about number of buried cards
This commit is contained in:
parent
1c9b5a2e83
commit
3cdb3d72c1
@ -6,9 +6,13 @@ studying-buried-siblings = Buried Siblings
|
|||||||
studying-bury = Bury
|
studying-bury = Bury
|
||||||
studying-bury-card = Bury Card
|
studying-bury-card = Bury Card
|
||||||
studying-bury-note = Bury Note
|
studying-bury-note = Bury Note
|
||||||
studying-card-buried = Card buried.
|
|
||||||
studying-card-suspended = Card suspended.
|
studying-card-suspended = Card suspended.
|
||||||
studying-card-was-a-leech = Card was a leech.
|
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-cards-will-be-automatically-returned-to = Cards will be automatically returned to their original decks after you review them.
|
||||||
studying-continue = Continue
|
studying-continue = Continue
|
||||||
studying-delete-note = Delete Note
|
studying-delete-note = Delete Note
|
||||||
@ -25,7 +29,6 @@ studying-manually-buried-cards = Manually Buried Cards
|
|||||||
studying-mark-note = Mark Note
|
studying-mark-note = Mark Note
|
||||||
studying-more = More
|
studying-more = More
|
||||||
studying-no-cards-are-due-yet = No cards are due yet.
|
studying-no-cards-are-due-yet = No cards are due yet.
|
||||||
studying-note-buried = Note buried.
|
|
||||||
studying-note-suspended = Note suspended.
|
studying-note-suspended = Note suspended.
|
||||||
studying-pause-audio = Pause Audio
|
studying-pause-audio = Pause Audio
|
||||||
studying-please-run-toolsempty-cards = Please run Tools>Empty Cards
|
studying-please-run-toolsempty-cards = Please run Tools>Empty Cards
|
||||||
|
@ -1027,16 +1027,14 @@ time = %(time)d;
|
|||||||
).success(lambda _: tooltip(tr.studying_card_suspended())).run_in_background()
|
).success(lambda _: tooltip(tr.studying_card_suspended())).run_in_background()
|
||||||
|
|
||||||
def bury_current_note(self) -> None:
|
def bury_current_note(self) -> None:
|
||||||
bury_notes(
|
bury_notes(parent=self.mw, note_ids=[self.card.nid],).success(
|
||||||
parent=self.mw,
|
lambda res: tooltip(tr.studying_cards_buried(count=res.count))
|
||||||
note_ids=[self.card.nid],
|
).run_in_background()
|
||||||
).success(lambda _: tooltip(tr.studying_note_buried())).run_in_background()
|
|
||||||
|
|
||||||
def bury_current_card(self) -> None:
|
def bury_current_card(self) -> None:
|
||||||
bury_cards(
|
bury_cards(parent=self.mw, card_ids=[self.card.id],).success(
|
||||||
parent=self.mw,
|
lambda res: tooltip(tr.studying_cards_buried(count=res.count))
|
||||||
card_ids=[self.card.id],
|
).run_in_background()
|
||||||
).success(lambda _: tooltip(tr.studying_card_buried())).run_in_background()
|
|
||||||
|
|
||||||
def delete_current_note(self) -> None:
|
def delete_current_note(self) -> None:
|
||||||
# need to check state because the shortcut is global to the main
|
# need to check state because the shortcut is global to the main
|
||||||
|
@ -92,29 +92,32 @@ impl Collection {
|
|||||||
let mut count = 0;
|
let mut count = 0;
|
||||||
let usn = self.usn()?;
|
let usn = self.usn()?;
|
||||||
let sched = self.scheduler_version();
|
let sched = self.scheduler_version();
|
||||||
|
let desired_queue = match mode {
|
||||||
|
BuryOrSuspendMode::Suspend => CardQueue::Suspended,
|
||||||
|
BuryOrSuspendMode::BurySched => CardQueue::SchedBuried,
|
||||||
|
BuryOrSuspendMode::BuryUser => {
|
||||||
|
if sched == SchedulerVersion::V1 {
|
||||||
|
// v1 scheduler only had one bury type
|
||||||
|
CardQueue::SchedBuried
|
||||||
|
} else {
|
||||||
|
CardQueue::UserBuried
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
for original in self.storage.all_searched_cards()? {
|
for original in self.storage.all_searched_cards()? {
|
||||||
let mut card = original.clone();
|
let mut card = original.clone();
|
||||||
let desired_queue = match mode {
|
|
||||||
BuryOrSuspendMode::Suspend => CardQueue::Suspended,
|
|
||||||
BuryOrSuspendMode::BurySched => CardQueue::SchedBuried,
|
|
||||||
BuryOrSuspendMode::BuryUser => {
|
|
||||||
if sched == SchedulerVersion::V1 {
|
|
||||||
// v1 scheduler only had one bury type
|
|
||||||
CardQueue::SchedBuried
|
|
||||||
} else {
|
|
||||||
CardQueue::UserBuried
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if card.queue != desired_queue {
|
if card.queue != desired_queue {
|
||||||
if sched == SchedulerVersion::V1 {
|
// do not bury suspended cards as that would unsuspend them
|
||||||
card.remove_from_filtered_deck_restoring_queue(sched);
|
if card.queue != CardQueue::Suspended {
|
||||||
card.remove_from_learning();
|
if sched == SchedulerVersion::V1 {
|
||||||
|
card.remove_from_filtered_deck_restoring_queue(sched);
|
||||||
|
card.remove_from_learning();
|
||||||
|
}
|
||||||
|
card.queue = desired_queue;
|
||||||
|
count += 1;
|
||||||
|
self.update_card_inner(&mut card, original, usn)?;
|
||||||
}
|
}
|
||||||
card.queue = desired_queue;
|
|
||||||
count += 1;
|
|
||||||
self.update_card_inner(&mut card, original, usn)?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user