Skip to content
Draft
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
2 changes: 1 addition & 1 deletion Overlay.qml
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ Item {
targetErrors: Model.drillTargetErrors(root.challenge, root.keyMistakes, root.bigramMistakes),
characters: root.correctChars,
wpm: finalWpm,
rawWpm: Model.rawWordsPerMinute(root.totalKeypresses, root.elapsedMs),
rawWpm: Model.wordsPerMinute(root.totalKeypresses, root.elapsedMs),
accuracy: Model.accuracy(root.totalKeypresses, root.incorrectKeypresses),
consistency: Model.consistency(root.paceSamples),
errors: root.incorrectKeypresses,
Expand Down
9 changes: 2 additions & 7 deletions TypearchyModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,9 @@ function advanceLineBreaks(mode, prompt, typed, character) {
return next
}

function wordsPerMinute(correctChars, elapsedMs) {
function wordsPerMinute(characters, elapsedMs) {
if (!(elapsedMs > 0)) return 0
return round((correctChars / 5) / (elapsedMs / 60000), 1)
}

function rawWordsPerMinute(keypresses, elapsedMs) {
if (!(elapsedMs > 0)) return 0
return round((keypresses / 5) / (elapsedMs / 60000), 1)
return round((characters / 5) / (elapsedMs / 60000), 1)
}

function accuracy(keypresses, incorrectKeypresses) {
Expand Down
2 changes: 1 addition & 1 deletion tests/model.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ assert.match(model.renderedPrompt("one\ntwo", "one\u0001", {
normal: "#ffffff", dim: "#777777", error: "#ff0000", cursor: "#ffffff", background: "#000000"
}), /color:#ffffff/)
assert.equal(model.wordsPerMinute(150, 30000), 60)
assert.equal(model.rawWordsPerMinute(175, 30000), 70)
assert.equal(model.wordsPerMinute(175, 30000), 70)
assert.equal(model.accuracy(100, 3), 97)
assert.equal(model.consistency([60, 60, 60]), 100)
assert.equal(model.eraseWordIndex("one two"), 4)
Expand Down
61 changes: 0 additions & 61 deletions website/db/schema.ts

This file was deleted.