Skill tree progression system & whitespace support

This commit is contained in:
2026-02-15 07:30:34 +00:00
parent 13550505c1
commit 6d6815af02
22 changed files with 2883 additions and 238 deletions

View File

@@ -17,12 +17,18 @@ pub struct DrillResult {
pub per_key_times: Vec<KeyTime>,
#[serde(default = "default_drill_mode", alias = "lesson_mode")]
pub drill_mode: String,
#[serde(default = "default_true")]
pub ranked: bool,
}
fn default_drill_mode() -> String {
"adaptive".to_string()
}
fn default_true() -> bool {
true
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct KeyTime {
pub key: char,
@@ -31,7 +37,7 @@ pub struct KeyTime {
}
impl DrillResult {
pub fn from_drill(drill: &DrillState, events: &[KeystrokeEvent], drill_mode: &str) -> Self {
pub fn from_drill(drill: &DrillState, events: &[KeystrokeEvent], drill_mode: &str, ranked: bool) -> Self {
let per_key_times: Vec<KeyTime> = events
.windows(2)
.map(|pair| {
@@ -63,6 +69,7 @@ impl DrillResult {
timestamp: Utc::now(),
per_key_times,
drill_mode: drill_mode.to_string(),
ranked,
}
}
}