substituting first stored keypress duration start with test start (because stats are reset on test start)

This commit is contained in:
Miodec 2023-03-28 17:05:11 +02:00
parent c9f5934808
commit 04ce710e93

View file

@ -1,5 +1,6 @@
import * as TestWords from "./test-words";
import { roundTo2, stdDev, mean } from "../utils/misc";
import * as TestStats from "./test-stats";
interface Keypress {
count: number;
@ -240,7 +241,12 @@ let newKeypresDurationArray: number[] = [];
export function recordKeyupTime(key: string): void {
const now = performance.now();
const diff = Math.abs(keysObj[key] - now);
let diff = Math.abs(keysObj[key] - now);
if (isNaN(diff) && newKeypresDurationArray.length === 0) {
diff = Math.abs(TestStats.start - now);
}
newKeypresDurationArray.push(roundTo2(diff));
delete keysObj[key];