Anki/rslib/src/decks/counts.rs
Damien Elmes 238441f2d9 use the backend for the deck due tree
- approx 3x faster on a large test deck
- counts are no longer capped to 1000 in the tree
2020-05-12 21:13:33 +10:00

21 lines
646 B
Rust

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use crate::{collection::Collection, decks::DeckID, err::Result};
use std::collections::HashMap;
#[derive(Debug)]
pub(crate) struct DueCounts {
pub new: u32,
pub review: u32,
pub learning: u32,
}
impl Collection {
pub(crate) fn due_counts(&mut self) -> Result<HashMap<DeckID, DueCounts>> {
let days_elapsed = self.timing_today()?.days_elapsed;
let learn_cutoff = self.learn_cutoff();
self.storage
.due_counts(self.sched_ver(), days_elapsed, learn_cutoff)
}
}