added the ability to see the percentage of correct keys after the test was finished

This commit is contained in:
Jack 2020-08-02 22:12:53 +01:00
parent fccb59a51d
commit bda44ffdb9
2 changed files with 10 additions and 1 deletions

View file

@ -705,7 +705,7 @@
</div>
<div class="group key">
<div class="top">char</div>
<div class="bottom">-</div>
<div class="bottom" aria-label="" data-balloon-pos="up">-</div>
</div>
<!-- </div> -->

View file

@ -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
);