Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,8 @@ mod tests {
let anchor = 1_000_000;
assert_eq!(Benchmark::session_timestamp(anchor, 0, 1), anchor);
assert_eq!(Benchmark::session_timestamp(anchor, 1, 1), anchor + 86400);
assert_eq!(Benchmark::session_timestamp(anchor, 1, 2), anchor + 172800);
assert_eq!(Benchmark::session_timestamp(anchor, 7, 1), anchor + 604800);
assert_eq!(Benchmark::session_timestamp(anchor, 1, 2), anchor + 172_800);
assert_eq!(Benchmark::session_timestamp(anchor, 7, 1), anchor + 604_800);
}

/// Verifies that exercise timestamps are calculated correctly within a session.
Expand Down
11 changes: 9 additions & 2 deletions src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ impl TryFrom<f32> for MasteryScore {

//@<lp-example-4
/// The result of a single trial.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct ExerciseTrial {
/// The ID of the exercise to which the trial belongs.
pub exercise_id: Ustr,

/// The score assigned to the exercise after the trial.
pub score: f32,

Expand All @@ -110,8 +113,11 @@ pub struct ExerciseTrial {
//>@lp-example-4

/// The delta between the predicted and actual score for a single exercise trial.
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
#[derive(Clone, Debug, Default, Deserialize, PartialEq, Serialize)]
pub struct ExerciseDelta {
/// The ID of the exercise to which the delta belongs.
pub exercise_id: Ustr,

/// The delta between the predicted and actual score.
pub delta: f32,

Expand Down Expand Up @@ -1483,6 +1489,7 @@ mod test {
#[test]
fn exercise_trial_clone() {
let trial = ExerciseTrial {
exercise_id: Ustr::from("exercise"),
score: 5.0,
timestamp: 1,
};
Expand Down
8 changes: 4 additions & 4 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ pub enum PracticeStatsError {
#[error("cannot get scores for unit {0}: {1}")]
GetScores(Ustr, #[source] anyhow::Error),

#[error("cannot record score for unit {0}: {1}")]
RecordScore(Ustr, #[source] anyhow::Error),
#[error("cannot record scores: {0}")]
RecordScore(#[source] anyhow::Error),

#[error("cannot trim scores: {0}")]
TrimScores(#[source] anyhow::Error),
Expand All @@ -77,8 +77,8 @@ pub enum PracticeDeltasError {
#[error("cannot get deltas for unit {0}: {1}")]
GetDeltas(Ustr, #[source] anyhow::Error),

#[error("cannot record delta for unit {0}: {1}")]
RecordDelta(Ustr, #[source] anyhow::Error),
#[error("cannot record deltas: {0}")]
RecordDelta(#[source] anyhow::Error),

#[error("cannot trim deltas: {0}")]
TrimDeltas(#[source] anyhow::Error),
Expand Down
Loading
Loading