pub fn review(&mut self, score: cards::Score) {
        // TODO: Ideally you would do the following, but borrowck fails:
        // let card_id = &self.sched.metacards[self.current_card].id;

        // Update the card.
        let tag_settings = self.deck.tag_settings(&self.deck.cards[&self.sched.metacards[self.current_card].id].tags);

        // The sum of the familiarities. Start with the global familiarity.
        let mut familiarity_sum = self.sched.statistics.familiarity;
        // The number of tags with familiarity statistics.
        let mut familiarity_num = 1;

        // Update statistics.
        self.sched.statistics.review(score, &tag_settings);
        // Update tagwise statistics.
        let tags = &self.deck.cards[&self.sched.metacards[self.current_card].id].tags;
        for tag in tags {
            if let Some(stat) = self.sched.tag_statistics.get_mut(tag) {
                // Update the sum.
                familiarity_sum += stat.familiarity;
                familiarity_num += 1;
                // Register the review.
                stat.review(score, &tag_settings);
            } else {
                // Create a new statistics tracker for the tag if it does not already exist.
                let mut stat = Statistics::new(&tag_settings);
                stat.review(score, &tag_settings);
                self.sched.tag_statistics.insert(tag.clone(), stat);
            }
        }

        // Calculate the average of the familiarity.
        let average_familiarity = familiarity_sum / familiarity_num as f32;
        // Register the review on the metacard.
        // TODO: Get rid of spaghetti.
        let priority = self.deck.cards[&self.sched.metacards[self.current_card].id].priority;
        let max_interval = self.deck.cards[&self.sched.metacards[self.current_card].id].max_interval;
        self.sched.metacards[self.current_card]
            .review(
                tag_settings,
                score,
                priority,
                average_familiarity,
                max_interval,
            );

        // Add back the card to the schedule.
        self.reschedule();

        // Pick a new card.
        self.pick_card();
        // Update the scheduler.
        self.update();
    }
/// Update the scheduler after a card was reviewed.
Update the scheduler after a card was reviewed.
Update the scheduler after a card was reviewed .
pub fn review(&mut self, score: cards::Score) {
        // TODO: Ideally you would do the following, but borrowck fails:
        // let card_id = &self.sched.metacards[self.current_card].id;
        // Update the card.
        let tag_settings = self.deck.tag_settings(&self.deck.cards[&self.sched.metacards[self.current_card].id].tags);
        // The sum of the familiarities. Start with the global familiarity.
        let mut familiarity_sum = self.sched.statistics.familiarity;
        // The number of tags with familiarity statistics.
        let mut familiarity_num = 1;
        // Update statistics.
        self.sched.statistics.review(score, &tag_settings);
        // Update tagwise statistics.
        let tags = &self.deck.cards[&self.sched.metacards[self.current_card].id].tags;
        for tag in tags {
            if let Some(stat) = self.sched.tag_statistics.get_mut(tag) {
                // Update the sum.
                familiarity_sum += stat.familiarity;
                familiarity_num += 1;
                // Register the review.
                stat.review(score, &tag_settings);
            } else {
                // Create a new statistics tracker for the tag if it does not already exist.
                let mut stat = Statistics::new(&tag_settings);
                stat.review(score, &tag_settings);
                self.sched.tag_statistics.insert(tag.clone(), stat);
            }
        }
        // Calculate the average of the familiarity.
        let average_familiarity = familiarity_sum / familiarity_num as f32;
        // Register the review on the metacard.
        // TODO: Get rid of spaghetti.
        let priority = self.deck.cards[&self.sched.metacards[self.current_card].id].priority;
        let max_interval = self.deck.cards[&self.sched.metacards[self.current_card].id].max_interval;
        self.sched.metacards[self.current_card]
            .review(
                tag_settings,
                score,
                priority,
                average_familiarity,
                max_interval,
            );
        // Add back the card to the schedule.
        self.reschedule();
        // Pick a new card.
        self.pick_card();
        // Update the scheduler.
        self.update();
    }
pub fn review ( & mut self , score : cards :: Score ) { // TODO: Ideally you would do the following, but borrowck fails: // let card_id = &self.sched.metacards[self.current_card].id; // Update the card. let tag_settings = self . deck . tag_settings ( & self . deck . cards [ & self . sched . metacards [ self . current_card ] . id ] . tags ) ; // The sum of the familiarities. Start with the global familiarity. let mut familiarity_sum = self . sched . statistics . familiarity ; // The number of tags with familiarity statistics. let mut familiarity_num = 1 ; // Update statistics. self . sched . statistics . review ( score , & tag_settings ) ; // Update tagwise statistics. let tags = & self . deck . cards [ & self . sched . metacards [ self . current_card ] . id ] . tags ; for tag in tags { if let Some ( stat ) = self . sched . tag_statistics . get_mut ( tag ) { // Update the sum. familiarity_sum += stat . familiarity ; familiarity_num += 1 ; // Register the review. stat . review ( score , & tag_settings ) ; } else { // Create a new statistics tracker for the tag if it does not already exist. let mut stat = Statistics :: new ( & tag_settings ) ; stat . review ( score , & tag_settings ) ; self . sched . tag_statistics . insert ( tag . clone ( ) , stat ) ; } } // Calculate the average of the familiarity. let average_familiarity = familiarity_sum / familiarity_num as f32 ; // Register the review on the metacard. // TODO: Get rid of spaghetti. let priority = self . deck . cards [ & self . sched . metacards [ self . current_card ] . id ] . priority ; let max_interval = self . deck . cards [ & self . sched . metacards [ self . current_card ] . id ] . max_interval ; self . sched . metacards [ self . current_card ] . review ( tag_settings , score , priority , average_familiarity , max_interval , ) ; // Add back the card to the schedule. self . reschedule ( ) ; // Pick a new card. self . pick_card ( ) ; // Update the scheduler. self . update ( ) ; }
Update the scheduler after a card was reviewed.
Update the scheduler after a card was reviewed .
&mut self
score
cards::Score
&mut self
score
cards::Score