Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "practice missed words" mode #89

Merged
merged 2 commits into from
Sep 19, 2023

Conversation

glazari
Copy link
Contributor

@glazari glazari commented Aug 16, 2023

Motivation

Monkeytype has the possibility of training just the words that you miss and this seems like a straight forward thing to add.

Implementation

Main change is to add a mssed_words item to the Result struct

pub struct Results {
    pub timing: TimingData,
    pub accuracy: AccuracyData,
    pub missed_words: Vec<String>,
}

And on the Results State, listen for 'p' (practice) to start a new test from missed words.

state = State::Test(Test::from_missed_words(&result.missed_words));

For the Results struct I did a very small refactor in the From<&Test> Trait implementation. I moved the calculation of each result to its own function, to leave the From function easier to follow.

Self {
    timing: Self::calc_timing(&events),
    accuracy: Self::calc_accuracy(&events),
    missed_words: Self::calc_missed_words(&test),
}

\## Motivation

Monkeytype has the possibility of training just the words that you miss
and this seems like a straight forward thing to add.

\## Implementation

Main change is to add a mssed_words item to the Result struct

```rust
pub struct Results {
    pub timing: TimingData,
    pub accuracy: AccuracyData,
    pub missed_words: Vec<String>,
}
```

And on the Results State, listen for 'p' (practice) to start a new test
from missed words.

```rust
state = State::Test(Test::from_missed_words(&result.missed_words));
```

For the `Results` struct I did a very small refactor in the
`From<&Test>` Trait implementation. I moved the calculation of each
result to its own function, to leave the From function easier to follow.

```rust
Self {
    timing: Self::calc_timing(&events),
    accuracy: Self::calc_accuracy(&events),
    missed_words: Self::calc_missed_words(&test),
}
```
@glazari
Copy link
Contributor Author

glazari commented Aug 17, 2023

This would solve the issue I created: #88
And it also goes in the direction of ttyperV2: #83

Copy link
Owner

@max-niederman max-niederman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Sorry for the late review -- I've been busy with school these past couple weeks.

src/test/results.rs Outdated Show resolved Hide resolved
src/test/mod.rs Outdated Show resolved Hide resolved
src/ui.rs Outdated Show resolved Hide resolved
@glazari
Copy link
Contributor Author

glazari commented Aug 31, 2023

Thanks for reviewing my PR and suggesting updates.
I made the updates you suggested!

thanks again for the nice project

@max-niederman max-niederman merged commit d1fb17c into max-niederman:main Sep 19, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants