mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-04 21:09:18 +08:00
added stddev and avg to stats function
This commit is contained in:
parent
bb168aa994
commit
a65f017431
1 changed files with 26 additions and 1 deletions
|
@ -42,7 +42,7 @@ export let keypressTimings = {
|
|||
};
|
||||
|
||||
export function getStats() {
|
||||
return {
|
||||
let ret = {
|
||||
start,
|
||||
end,
|
||||
wpmHistory,
|
||||
|
@ -57,6 +57,31 @@ export function getStats() {
|
|||
accuracy,
|
||||
keypressTimings,
|
||||
};
|
||||
|
||||
try {
|
||||
ret.keySpacingStats = {
|
||||
average:
|
||||
keypressTimings.spacing.array.reduce(
|
||||
(previous, current) => (current += previous)
|
||||
) / keypressTimings.spacing.array.length,
|
||||
sd: Misc.stdDev(keypressTimings.spacing.array),
|
||||
};
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
try {
|
||||
ret.keyDurationStats = {
|
||||
average:
|
||||
keypressTimings.duration.array.reduce(
|
||||
(previous, current) => (current += previous)
|
||||
) / keypressTimings.duration.array.length,
|
||||
sd: Misc.stdDev(keypressTimings.duration.array),
|
||||
};
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
export function restart() {
|
||||
|
|
Loading…
Reference in a new issue