mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Config for burying interday learning cards (#1680)
* Add config for burying interday learning cards * Expose bury interday learning config in GUI
This commit is contained in:
parent
337f96fce8
commit
131a94dd85
12 changed files with 45 additions and 8 deletions
|
@ -87,8 +87,9 @@ deck-config-leech-action-tooltip =
|
|||
## Burying section
|
||||
|
||||
deck-config-bury-title = Burying
|
||||
deck-config-bury-new-siblings = Bury new siblings until the next day
|
||||
deck-config-bury-review-siblings = Bury review siblings until the next day
|
||||
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-tooltip =
|
||||
Whether other cards of the same note (eg reverse cards, adjacent
|
||||
cloze deletions) will be delayed until the next day.
|
||||
|
|
|
@ -88,7 +88,7 @@ message DeckConfig {
|
|||
uint32 reviews_per_day = 10;
|
||||
|
||||
// not currently used
|
||||
uint32 new_per_day_minimum = 29;
|
||||
uint32 new_per_day_minimum = 35;
|
||||
|
||||
float initial_ease = 11;
|
||||
float easy_multiplier = 12;
|
||||
|
@ -121,6 +121,7 @@ message DeckConfig {
|
|||
|
||||
bool bury_new = 27;
|
||||
bool bury_reviews = 28;
|
||||
bool bury_interday_learning = 29;
|
||||
|
||||
bytes other = 255;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ impl Default for DeckConfig {
|
|||
skip_question_when_replaying_answer: false,
|
||||
bury_new: false,
|
||||
bury_reviews: false,
|
||||
bury_interday_learning: false,
|
||||
other: vec![],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -54,6 +54,8 @@ pub struct DeckConfSchema11 {
|
|||
new_sort_order: i32,
|
||||
#[serde(default)]
|
||||
new_gather_priority: i32,
|
||||
#[serde(default)]
|
||||
bury_interday_learning: bool,
|
||||
|
||||
#[serde(flatten)]
|
||||
other: HashMap<String, Value>,
|
||||
|
@ -243,6 +245,7 @@ impl Default for DeckConfSchema11 {
|
|||
review_order: 0,
|
||||
new_sort_order: 0,
|
||||
new_gather_priority: 0,
|
||||
bury_interday_learning: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -310,6 +313,7 @@ impl From<DeckConfSchema11> for DeckConfig {
|
|||
skip_question_when_replaying_answer: !c.replayq,
|
||||
bury_new: c.new.bury,
|
||||
bury_reviews: c.rev.bury,
|
||||
bury_interday_learning: c.bury_interday_learning,
|
||||
other: other_bytes,
|
||||
},
|
||||
}
|
||||
|
@ -397,6 +401,7 @@ impl From<DeckConfig> for DeckConfSchema11 {
|
|||
review_order: i.review_order,
|
||||
new_sort_order: i.new_card_sort_order,
|
||||
new_gather_priority: i.new_card_gather_priority,
|
||||
bury_interday_learning: i.bury_interday_learning,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -416,6 +421,7 @@ fn clear_other_duplicates(top_other: &mut HashMap<String, Value>) {
|
|||
"reviewOrder",
|
||||
"newSortOrder",
|
||||
"newGatherPriority",
|
||||
"buryInterdayLearning",
|
||||
] {
|
||||
top_other.remove(*key);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ mod review;
|
|||
mod revlog;
|
||||
|
||||
use rand::{prelude::*, rngs::StdRng};
|
||||
|
||||
use revlog::RevlogEntryPartial;
|
||||
|
||||
use super::{
|
||||
|
@ -281,6 +280,7 @@ impl Collection {
|
|||
card.note_id,
|
||||
config.inner.bury_new,
|
||||
config.inner.bury_reviews,
|
||||
config.inner.bury_interday_learning,
|
||||
)?;
|
||||
}
|
||||
|
||||
|
|
|
@ -147,9 +147,15 @@ impl Collection {
|
|||
nid: NoteId,
|
||||
include_new: bool,
|
||||
include_reviews: bool,
|
||||
include_day_learn: bool,
|
||||
) -> Result<usize> {
|
||||
self.storage
|
||||
.search_siblings_for_bury(cid, nid, include_new, include_reviews)?;
|
||||
self.storage.search_siblings_for_bury(
|
||||
cid,
|
||||
nid,
|
||||
include_new,
|
||||
include_reviews,
|
||||
include_day_learn,
|
||||
)?;
|
||||
self.bury_or_suspend_searched_cards(BuryOrSuspendMode::BurySched)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ impl Context {
|
|||
.map(|config| BuryMode {
|
||||
bury_new: config.inner.bury_new,
|
||||
bury_reviews: config.inner.bury_reviews,
|
||||
bury_interday_learning: config.inner.bury_interday_learning,
|
||||
})
|
||||
.unwrap_or_default()
|
||||
}
|
||||
|
@ -68,6 +69,7 @@ impl QueueBuilder {
|
|||
previous_mode = Some(*entry);
|
||||
entry.bury_new |= new_mode.bury_new;
|
||||
entry.bury_reviews |= new_mode.bury_reviews;
|
||||
entry.bury_interday_learning |= new_mode.bury_interday_learning;
|
||||
})
|
||||
.or_insert(new_mode);
|
||||
|
||||
|
|
|
@ -122,7 +122,10 @@ impl QueueBuilder {
|
|||
fn add_due_card(&mut self, card: DueCard) -> bool {
|
||||
let bury_this_card = self
|
||||
.get_and_update_bury_mode_for_note(card.into())
|
||||
.map(|mode| mode.bury_reviews)
|
||||
.map(|mode| match card.kind {
|
||||
DueCardKind::Review => mode.bury_reviews,
|
||||
DueCardKind::Learning => mode.bury_interday_learning,
|
||||
})
|
||||
.unwrap_or_default();
|
||||
if bury_this_card {
|
||||
false
|
||||
|
|
|
@ -89,6 +89,7 @@ impl From<DueCard> for LearningQueueEntry {
|
|||
pub(super) struct BuryMode {
|
||||
bury_new: bool,
|
||||
bury_reviews: bool,
|
||||
bury_interday_learning: bool,
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Debug)]
|
||||
|
|
|
@ -417,6 +417,7 @@ impl super::SqliteStorage {
|
|||
nid: NoteId,
|
||||
include_new: bool,
|
||||
include_reviews: bool,
|
||||
include_day_learn: bool,
|
||||
) -> Result<()> {
|
||||
self.setup_searched_cards_table()?;
|
||||
let params = named_params! {
|
||||
|
@ -424,6 +425,7 @@ impl super::SqliteStorage {
|
|||
":note_id": nid,
|
||||
":include_new": include_new,
|
||||
":include_reviews": include_reviews,
|
||||
":include_day_learn": include_day_learn,
|
||||
":new_queue": CardQueue::New as i8,
|
||||
":review_queue": CardQueue::Review as i8,
|
||||
":daylearn_queue": CardQueue::DayLearn as i8,
|
||||
|
|
|
@ -10,6 +10,10 @@ WHERE id != :card_id
|
|||
)
|
||||
OR (
|
||||
:include_reviews
|
||||
AND queue IN (:review_queue, :daylearn_queue)
|
||||
AND queue = :review_queue
|
||||
)
|
||||
OR (
|
||||
:include_day_learn
|
||||
AND queue = :daylearn_queue
|
||||
)
|
||||
);
|
|
@ -38,5 +38,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
{tr.deckConfigBuryReviewSiblings()}
|
||||
</SwitchRow>
|
||||
</Item>
|
||||
|
||||
<Item>
|
||||
<SwitchRow
|
||||
bind:value={$config.buryInterdayLearning}
|
||||
defaultValue={defaults.buryInterdayLearning}
|
||||
markdownTooltip={tr.deckConfigBuryTooltip()}
|
||||
>
|
||||
{tr.deckConfigBuryInterdayLearningSiblings()}
|
||||
</SwitchRow>
|
||||
</Item>
|
||||
</DynamicallySlottable>
|
||||
</TitledContainer>
|
||||
|
|
Loading…
Reference in a new issue