Show a proper timer

This commit is contained in:
2025-02-15 19:30:03 +01:00
parent d3c6a4e024
commit f617689d2b
3 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ function Code({code, loaded}: CodeProps) {
const incorrectlyTyped = characters.filter(char => !char).length;
if (timer > 0) {
setScore((typed / 5 - incorrectlyTyped) / (timer / 60));
setScore(Math.abs(typed / 5 - incorrectlyTyped) / (timer / 60));
setAccuracy(correctlyTyped / typed * 100);
}
// eslint-disable-next-line react-hooks/exhaustive-deps