diff --git a/ftl/core/deck-config.ftl b/ftl/core/deck-config.ftl index e806086ac..46e90a2f9 100644 --- a/ftl/core/deck-config.ftl +++ b/ftl/core/deck-config.ftl @@ -104,22 +104,28 @@ deck-config-leech-action-tooltip = ## Burying section deck-config-bury-title = Burying -deck-config-bury-siblings = Bury siblings -deck-config-do-not-bury = Do not bury siblings -deck-config-bury-if-new = Bury if new -deck-config-bury-if-new-or-review = Bury if new or review -deck-config-bury-if-new-review-or-interday = Bury if new, review, or interday learning -deck-config-bury-tooltip = - Siblings are other cards from the same note (eg forward/reverse cards, or - other cloze deletions from the same text). - - When this option is off, multiple cards from the same note may be seen on the same - day. When enabled, Anki will automatically *bury* siblings, hiding them until the next - day. This option allows you to choose which kinds of cards may be buried when you answer - one of their siblings. - - When using the V3 scheduler, interday learning cards can also be buried. Interday - learning cards are cards with a current learning step of one or more days. +deck-config-bury-new-siblings = Bury new siblings +deck-config-bury-review-siblings = Bury review siblings +deck-config-bury-interday-learning-siblings = Bury interday learning siblings +deck-config-bury-new-tooltip = + Whether other `new` cards of the same note (eg reverse cards, adjacent cloze deletions) + will be delayed until the next day. +deck-config-bury-review-tooltip = Whether other `review` cards of the same note will be delayed until the next day. +deck-config-bury-interday-learning-tooltip = + Whether other `learning` cards of the same note with intervals > 1 day + will be delayed until the next day. +deck-config-bury-priority-tooltip = + When Anki gathers cards, it first gathers intraday learning cards, then + interday learning cards, then reviews, and finally new cards. This affects + how burying works: + + - If you have all burying options enabled, the sibling that comes earliest in + that list will be shown. For example, a review card will be shown in preference + to a new card. + - Siblings later in the list can not bury earlier card types. For example, if you + disable burying of new cards, and study a new card, it will not bury any interday + learning or review cards, and you may see both a review sibling and new sibling in the + same session. ## Ordering section @@ -304,13 +310,19 @@ deck-config-which-deck = Which deck would you like? ## NO NEED TO TRANSLATE. This text is no longer used by Anki, and will be removed in the future. -deck-config-bury-new-siblings = Bury new siblings -deck-config-bury-review-siblings = Bury review siblings -deck-config-bury-interday-learning-siblings = Bury interday learning siblings -deck-config-bury-new-tooltip = - Whether other `new` cards of the same note (eg reverse cards, adjacent cloze deletions) - will be delayed until the next day. -deck-config-bury-review-tooltip = Whether other `review` cards of the same note will be delayed until the next day. -deck-config-bury-interday-learning-tooltip = - Whether other `learning` cards of the same note with intervals > 1 day - will be delayed until the next day. +deck-config-bury-siblings = Bury siblings +deck-config-do-not-bury = Do not bury siblings +deck-config-bury-if-new = Bury if new +deck-config-bury-if-new-or-review = Bury if new or review +deck-config-bury-if-new-review-or-interday = Bury if new, review, or interday learning +deck-config-bury-tooltip = + Siblings are other cards from the same note (eg forward/reverse cards, or + other cloze deletions from the same text). + + When this option is off, multiple cards from the same note may be seen on the same + day. When enabled, Anki will automatically *bury* siblings, hiding them until the next + day. This option allows you to choose which kinds of cards may be buried when you answer + one of their siblings. + + When using the V3 scheduler, interday learning cards can also be buried. Interday + learning cards are cards with a current learning step of one or more days. diff --git a/proto/anki/deckconfig.proto b/proto/anki/deckconfig.proto index 4877bac53..f4a796d80 100644 --- a/proto/anki/deckconfig.proto +++ b/proto/anki/deckconfig.proto @@ -124,13 +124,8 @@ message DeckConfig { bool show_timer = 25; bool skip_question_when_replaying_answer = 26; - // the new scheduler doesn't allow toggling these booleans freely anymore, - // but they are continued to be used for reasons of backwards compatibility - bool bury_new = 27; - // only respected if bury_new bool bury_reviews = 28; - // only respected if bury_new and bury_reviews bool bury_interday_learning = 29; bytes other = 255; diff --git a/rslib/src/scheduler/answering/mod.rs b/rslib/src/scheduler/answering/mod.rs index 1cb874a86..93e501d4c 100644 --- a/rslib/src/scheduler/answering/mod.rs +++ b/rslib/src/scheduler/answering/mod.rs @@ -288,7 +288,7 @@ impl Collection { fn maybe_bury_siblings(&mut self, card: &Card, config: &DeckConfig) -> Result<()> { let bury_mode = BuryMode::from_deck_config(config); if bury_mode.any_burying() { - self.bury_siblings(card.id, card.note_id, bury_mode)?; + self.bury_siblings(card, card.note_id, bury_mode)?; } Ok(()) } diff --git a/rslib/src/scheduler/bury_and_suspend.rs b/rslib/src/scheduler/bury_and_suspend.rs index ba71396e4..97b00ce7d 100644 --- a/rslib/src/scheduler/bury_and_suspend.rs +++ b/rslib/src/scheduler/bury_and_suspend.rs @@ -80,7 +80,6 @@ impl Collection { }) } - /// Bury/suspend cards in search table, and clear it. /// Marks the cards as modified. fn bury_or_suspend_cards_inner( &mut self, @@ -139,15 +138,39 @@ impl Collection { pub(crate) fn bury_siblings( &mut self, - cid: CardId, + card: &Card, nid: NoteId, - bury_mode: BuryMode, + mut bury_mode: BuryMode, ) -> Result { - let cards = self.storage.all_siblings_for_bury(cid, nid, bury_mode)?; + bury_mode.exclude_earlier_gathered_queues(card.queue); + let cards = self + .storage + .all_siblings_for_bury(card.id, nid, bury_mode)?; self.bury_or_suspend_cards_inner(cards, BuryOrSuspendMode::BurySched) } } +impl BuryMode { + /// Disables burying for queues gathered before `queue`. + fn exclude_earlier_gathered_queues(&mut self, queue: CardQueue) { + self.bury_interday_learning &= queue.gather_ord() <= CardQueue::DayLearn.gather_ord(); + self.bury_reviews &= queue.gather_ord() <= CardQueue::Review.gather_ord(); + } +} + +impl CardQueue { + fn gather_ord(self) -> u8 { + match self { + CardQueue::Learn | CardQueue::PreviewRepeat => 0, + CardQueue::DayLearn => 1, + CardQueue::Review => 2, + CardQueue::New => 3, + // not gathered + CardQueue::Suspended | CardQueue::SchedBuried | CardQueue::UserBuried => u8::MAX, + } + } +} + #[cfg(test)] mod test { use crate::card::Card; diff --git a/rslib/src/scheduler/queue/builder/burying.rs b/rslib/src/scheduler/queue/builder/burying.rs index 07825c9d7..2bd843a94 100644 --- a/rslib/src/scheduler/queue/builder/burying.rs +++ b/rslib/src/scheduler/queue/builder/burying.rs @@ -56,15 +56,10 @@ impl Context { impl BuryMode { pub(crate) fn from_deck_config(config: &DeckConfig) -> BuryMode { let cfg = &config.inner; - // Since cards are gathered in a certain order (learning > review > new) and - // a card can only bury siblings that are gathered later, only the four bury - // modes following this order are allowed. - // Booleans are continued to be used for reasons of backwards compatibility. - // https://github.com/ankitects/anki/issues/2352 BuryMode { bury_new: cfg.bury_new, - bury_reviews: cfg.bury_new && cfg.bury_reviews, - bury_interday_learning: cfg.bury_new && cfg.bury_reviews && cfg.bury_interday_learning, + bury_reviews: cfg.bury_reviews, + bury_interday_learning: cfg.bury_interday_learning, } } diff --git a/rslib/src/scheduler/queue/builder/mod.rs b/rslib/src/scheduler/queue/builder/mod.rs index 7c26e50d8..63808e072 100644 --- a/rslib/src/scheduler/queue/builder/mod.rs +++ b/rslib/src/scheduler/queue/builder/mod.rs @@ -456,7 +456,7 @@ mod test { #[test] fn new_card_potentially_burying_review_card() { - let mut col = open_test_collection(); + let mut col = Collection::new_v3(); // add one new and one review card CardAdder::new().siblings(2).due_dates(["0"]).add(&mut col); // Potentially problematic config: New cards are shown first and would bury diff --git a/ts/deck-options/BuryOptions.svelte b/ts/deck-options/BuryOptions.svelte index 218e6423c..7988ea9c8 100644 --- a/ts/deck-options/BuryOptions.svelte +++ b/ts/deck-options/BuryOptions.svelte @@ -3,7 +3,6 @@ Copyright: Ankitects Pty Ltd and contributors License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html --> @@ -78,7 +56,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html title={tr.deckConfigBuryTitle()} url="https://docs.ankiweb.net/studying.html#siblings-and-burying" slot="tooltip" - helpSections={[burySiblings]} + {helpSections} on:mount={(e) => { modal = e.detail.modal; carousel = e.detail.carousel; @@ -86,15 +64,46 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html /> - - openHelpModal()} - >{tr.deckConfigBurySiblings()} + + openHelpModal(Object.keys(settings).indexOf("buryNewSiblings"))} + >{settings.buryNewSiblings.title} - + + + + + + openHelpModal( + Object.keys(settings).indexOf("buryReviewSiblings"), + )}>{settings.buryReviewSiblings.title} + + + + {#if state.v3Scheduler} + + + + openHelpModal( + Object.keys(settings).indexOf( + "buryInterdayLearningSiblings", + ), + )} + >{settings.buryInterdayLearningSiblings.title} + + + {/if}