Remove some v3 checks
This commit is contained in:
parent
7252dd56b6
commit
e5170f341b
@ -57,14 +57,6 @@ impl Collection {
|
||||
};
|
||||
if let Some(mut deck) = self.storage.get_deck(did)? {
|
||||
self.update_deck_stats_single(today, usn, &mut deck, mutator)?;
|
||||
if !self.get_config_bool(BoolKey::Sched2021) {
|
||||
for mut deck in self.storage.parent_decks(&deck)? {
|
||||
self.update_deck_stats_single(today, usn, &mut deck, mutator)?;
|
||||
}
|
||||
for mut deck in self.storage.child_decks(&deck)? {
|
||||
self.update_deck_stats_single(today, usn, &mut deck, mutator)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -440,7 +440,6 @@ mod test {
|
||||
}
|
||||
|
||||
let mut col = Collection::new();
|
||||
col.set_config_bool(BoolKey::Sched2021, true, false)?;
|
||||
|
||||
let parent_deck = create_deck_with_new_limit(&mut col, "Default", 8);
|
||||
let child_deck = create_deck_with_new_limit(&mut col, "Default::child", 4);
|
||||
|
@ -627,7 +627,6 @@ mod test {
|
||||
let mut note = Note::new(&nt);
|
||||
col.add_note(&mut note, DeckId(1))?;
|
||||
}
|
||||
col.set_config_bool(BoolKey::Sched2021, true, false)?;
|
||||
let cids = col.search_cards("", SortMode::NoOrder)?;
|
||||
Ok((col, cids))
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ impl Collection {
|
||||
|
||||
let subtree = get_deck_in_tree(self.deck_tree(Some(TimestampSecs::now()))?, deck_id)
|
||||
.or_not_found(deck_id)?;
|
||||
let v3 = self.get_config_bool(BoolKey::Sched2021);
|
||||
let available_new_including_children =
|
||||
sum_deck_tree_node(&subtree, |node| node.new_uncapped);
|
||||
let available_review_including_children =
|
||||
@ -54,21 +53,12 @@ impl Collection {
|
||||
available_new_in_children,
|
||||
available_review,
|
||||
available_review_in_children,
|
||||
) = if v3 {
|
||||
(
|
||||
) = (
|
||||
subtree.new_uncapped,
|
||||
available_new_including_children - subtree.new_uncapped,
|
||||
subtree.review_uncapped,
|
||||
available_review_including_children - subtree.review_uncapped,
|
||||
)
|
||||
} else {
|
||||
(
|
||||
available_new_including_children,
|
||||
0,
|
||||
available_review_including_children,
|
||||
0,
|
||||
)
|
||||
};
|
||||
);
|
||||
// tags
|
||||
let include_tags: HashSet<String> = self.get_config_default(
|
||||
DeckConfigKey::CustomStudyIncludeTags
|
||||
|
@ -340,7 +340,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn should_build_empty_queue_if_limit_is_reached() {
|
||||
let mut col = Collection::new_v3();
|
||||
let mut col = Collection::new();
|
||||
CardAdder::new().due_dates(["0"]).add(&mut col);
|
||||
col.set_deck_review_limit(DeckId(1), 0);
|
||||
assert_eq!(col.queue_as_deck_and_template(DeckId(1)), vec![]);
|
||||
@ -348,7 +348,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn new_queue_building() -> Result<()> {
|
||||
let mut col = Collection::new_v3();
|
||||
let mut col = Collection::new();
|
||||
|
||||
// parent
|
||||
// ┣━━child━━grandchild
|
||||
@ -411,7 +411,6 @@ mod test {
|
||||
#[test]
|
||||
fn review_queue_building() -> Result<()> {
|
||||
let mut col = Collection::new();
|
||||
col.set_config_bool(BoolKey::Sched2021, true, false)?;
|
||||
|
||||
let mut deck = col.get_or_create_normal_deck("Default").unwrap();
|
||||
let nt = col.get_notetype_by_name("Basic")?.unwrap();
|
||||
@ -464,7 +463,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn new_card_potentially_burying_review_card() {
|
||||
let mut col = Collection::new_v3();
|
||||
let mut col = Collection::new();
|
||||
// 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
|
||||
@ -487,7 +486,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn new_cards_may_ignore_review_limit() {
|
||||
let mut col = Collection::new_v3();
|
||||
let mut col = Collection::new();
|
||||
col.set_config_bool(BoolKey::NewCardsIgnoreReviewLimit, true, false)
|
||||
.unwrap();
|
||||
col.update_default_deck_config(|config| {
|
||||
@ -501,7 +500,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn reviews_dont_affect_new_limit_before_review_limit_is_reached() {
|
||||
let mut col = Collection::new_v3();
|
||||
let mut col = Collection::new();
|
||||
col.update_default_deck_config(|config| {
|
||||
config.new_per_day = 1;
|
||||
});
|
||||
@ -511,7 +510,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn may_apply_parent_limits() {
|
||||
let mut col = Collection::new_v3();
|
||||
let mut col = Collection::new();
|
||||
col.set_config_bool(BoolKey::ApplyAllParentLimits, true, false)
|
||||
.unwrap();
|
||||
col.update_default_deck_config(|config| {
|
||||
|
@ -48,13 +48,6 @@ impl Collection {
|
||||
CollectionBuilder::default().build().unwrap()
|
||||
}
|
||||
|
||||
pub(crate) fn new_v3() -> Collection {
|
||||
let mut col = Collection::new();
|
||||
col.set_config_bool(BoolKey::Sched2021, true, false)
|
||||
.unwrap();
|
||||
col
|
||||
}
|
||||
|
||||
pub(crate) fn add_media(&self, media: &[(&str, &[u8])]) {
|
||||
let mgr = MediaManager::new(&self.media_folder, &self.media_db).unwrap();
|
||||
for (name, data) in media {
|
||||
|
Loading…
Reference in New Issue
Block a user