datle-dev / yubi

Minimalist typing test
MIT License
0 stars 0 forks source link

Wpm calcs #6

Closed datle-dev closed 3 months ago

datle-dev commented 3 months ago

Changes

Major Changes

Create a statistics component that displays raw and net WPM on completion of a typing test.

Bug Fixes / Minor Changes

Why

Reporting WPM is part of core functionality for a typing test.

How

State variables were added to track total number of characters typed as well as start/end time. These are passed as parameters along with the array of objects of expected word vs. typed word to the statistics component, which performs all the comparisons to determine what letters typed were correct, missed, or extra. WPM is calculated based on these values as well as the duration.

Notes

The calculations are based off a standard approach for determining WPM, but there is probably some interpretation on how it should be approached. But for what's included in this PR, it should be sufficient.