fn review(&mut self, score: cards::Score, settings: &settings::TagSettings) {
        // Record review.
        self.reviews.push(score);
        // Record activity.
        *self.activity.entry(now().date().naive_utc()).or_insert(0) += 1;
        // Update the performance average, taking the weighted average of the old average and a
        // value associated to the new score.
        self.adaptive_retention_rate = (1.0 - settings.score_weight) * self.adaptive_retention_rate
            + settings.score_weight * match score {
            cards::Score::Fail => 0.0,
            cards::Score::Hard => 0.75,
            cards::Score::Okay => 0.85,
            cards::Score::Good => 0.92,
            cards::Score::Easy => 1.1,
        };
        // TODO: Make this configurable.

        // Increase/decrease the increase if the adaptive retention rate is better/worse than the
        // desired retention rate.
        if self.adaptive_retention_rate >= settings.desired_retention_rate {
            // Increase familiarity by the delta.
            self.familiarity += settings.familiarity_delta;
            // Cap at the maximal familiarity.
            if self.familiarity > settings.max_familiarity {
                self.familiarity = settings.max_familiarity;
            }
        } else {
            // Decrease familiarity by the delta.
            self.familiarity -= settings.familiarity_delta;
            // Cap at the minimal familiarity.
            if self.familiarity < settings.min_familiarity {
                self.familiarity = settings.min_familiarity;
            }
        }
    }
/// Add a review of certain score to the statistics.
Add a review of certain score to the statistics.
Add a review of certain score to the statistics .
fn review(&mut self, score: cards::Score, settings: &settings::TagSettings) {
        // Record review.
        self.reviews.push(score);
        // Record activity.
        *self.activity.entry(now().date().naive_utc()).or_insert(0) += 1;
        // Update the performance average, taking the weighted average of the old average and a
        // value associated to the new score.
        self.adaptive_retention_rate = (1.0 - settings.score_weight) * self.adaptive_retention_rate
            + settings.score_weight * match score {
            cards::Score::Fail => 0.0,
            cards::Score::Hard => 0.75,
            cards::Score::Okay => 0.85,
            cards::Score::Good => 0.92,
            cards::Score::Easy => 1.1,
        };
        // TODO: Make this configurable.
        // Increase/decrease the increase if the adaptive retention rate is better/worse than the
        // desired retention rate.
        if self.adaptive_retention_rate >= settings.desired_retention_rate {
            // Increase familiarity by the delta.
            self.familiarity += settings.familiarity_delta;
            // Cap at the maximal familiarity.
            if self.familiarity > settings.max_familiarity {
                self.familiarity = settings.max_familiarity;
            }
        } else {
            // Decrease familiarity by the delta.
            self.familiarity -= settings.familiarity_delta;
            // Cap at the minimal familiarity.
            if self.familiarity < settings.min_familiarity {
                self.familiarity = settings.min_familiarity;
            }
        }
    }
fn review ( & mut self , score : cards :: Score , settings : & settings :: TagSettings ) { // Record review. self . reviews . push ( score ) ; // Record activity. * self . activity . entry ( now ( ) . date ( ) . naive_utc ( ) ) . or_insert ( 0 ) += 1 ; // Update the performance average, taking the weighted average of the old average and a // value associated to the new score. self . adaptive_retention_rate = ( 1.0 - settings . score_weight ) * self . adaptive_retention_rate + settings . score_weight * match score { cards :: Score :: Fail => 0.0 , cards :: Score :: Hard => 0.75 , cards :: Score :: Okay => 0.85 , cards :: Score :: Good => 0.92 , cards :: Score :: Easy => 1.1 , } ; // TODO: Make this configurable. // Increase/decrease the increase if the adaptive retention rate is better/worse than the // desired retention rate. if self . adaptive_retention_rate >= settings . desired_retention_rate { // Increase familiarity by the delta. self . familiarity += settings . familiarity_delta ; // Cap at the maximal familiarity. if self . familiarity > settings . max_familiarity { self . familiarity = settings . max_familiarity ; } } else { // Decrease familiarity by the delta. self . familiarity -= settings . familiarity_delta ; // Cap at the minimal familiarity. if self . familiarity < settings . min_familiarity { self . familiarity = settings . min_familiarity ; } } }
Add a review of certain score to the statistics.
Add a review of certain score to the statistics .
&mut self
score
cards::Score
settings
&settings::TagSettings
&mut self
score
cards::Score
settings
&settings::TagSettings