From bda44ffdb92dae7c65f8a864492fc4973c1a5aac Mon Sep 17 00:00:00 2001 From: Jack Date: Sun, 2 Aug 2020 22:12:53 +0100 Subject: [PATCH] added the ability to see the percentage of correct keys after the test was finished --- public/index.html | 2 +- public/js/script.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/public/index.html b/public/index.html index c13c85f35..ee531841d 100644 --- a/public/index.html +++ b/public/index.html @@ -705,7 +705,7 @@
char
-
-
+
-
diff --git a/public/js/script.js b/public/js/script.js index abe6424fd..7f68a7c0c 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -1379,6 +1379,15 @@ function showResult(difficultyFailed = false) { $("#result .stats .raw .bottom").attr("aria-label", stats.wpmRaw); $("#result .stats .acc .bottom").text(Math.floor(stats.acc) + "%"); $("#result .stats .acc .bottom").attr("aria-label", stats.acc + "%"); + + let correctcharpercent = roundTo2( + ((stats.correctChars + stats.correctSpaces) / + (stats.correctChars + stats.correctSpaces + stats.incorrectChars)) * + 100 + ); + $("#result .stats .key .bottom").text(testtime + "s"); + $("#result .stats .key .bottom").attr("aria-label", `${correctcharpercent}%`); + $("#result .stats .key .bottom").text( stats.correctChars + stats.correctSpaces + "/" + stats.incorrectChars );