added key consistency to the key popup

This commit is contained in:
Jack 2020-08-01 21:13:25 +01:00
parent 25684b8f40
commit 0c3f9fc8dd

View file

@ -1449,6 +1449,11 @@ function showResult(difficultyFailed = false) {
}
let consistency = roundTo2(kogasa(stddev / avg));
let keyConsistency = roundTo2(
kogasa(
stdDev(keypressStats.spacing.array) / mean(keypressStats.spacing.array)
)
);
if (isNaN(consistency)) {
consistency = 0;
@ -1457,7 +1462,7 @@ function showResult(difficultyFailed = false) {
$("#result .stats .consistency .bottom").text(Math.round(consistency) + "%");
$("#result .stats .consistency .bottom").attr(
"aria-label",
consistency + "%"
`${consistency}% (${keyConsistency}% key)`
);
wpmOverTimeChart.data.datasets[0].borderColor = themeColors.main;