diff --git a/public/index.html b/public/index.html index 4bc40aea7..67e40eff8 100644 --- a/public/index.html +++ b/public/index.html @@ -440,6 +440,21 @@
average wpm
(last 10 tests)
-
+ +
+
highest raw wpm
+
-
+
+
+
+
average raw wpm
+
-
+
+
+
average raw wpm
(last 10 tests)
+
-
+
+
tests started
-
diff --git a/public/js/account.js b/public/js/account.js index 87e200e75..67791eccd 100644 --- a/public/js/account.js +++ b/public/js/account.js @@ -401,6 +401,14 @@ function refreshAccountPage() { let totalAcc = 0; let totalAcc10 = 0; + let rawWpm = { + total: 0, + count: 0, + last10Total: 0, + last10Count: 0, + max: 0 + } + $(".pageAccount .history table tbody").empty(); dbSnapshot.forEach(result => { // console.log(result); @@ -440,6 +448,20 @@ function refreshAccountPage() { } testCount++; + + if(result.rawWpm != null){ + if(rawWpm.last10Count < 10){ + rawWpm.last10Count++; + rawWpm.last10Total += result.rawWpm; + } + rawWpm.total += result.rawWpm; + rawWpm.count++; + if(result.rawWpm > rawWpm.max){ + rawWpm.max = result.rawWpm; + } + } + + totalAcc += result.acc; if (result.restartCount != undefined) { @@ -514,6 +536,11 @@ function refreshAccountPage() { $(".pageAccount .highestWpm .val").text(topWpm); $(".pageAccount .averageWpm .val").text(Math.round(totalWpm/testCount)); $(".pageAccount .averageWpm10 .val").text(Math.round(wpmLast10total/last10)); + + $(".pageAccount .highestRaw .val").text(rawWpm.max); + $(".pageAccount .averageRaw .val").text(Math.round(rawWpm.total/rawWpm.count)); + $(".pageAccount .averageRaw10 .val").text(Math.round(rawWpm.last10Total/rawWpm.last10Count)); + $(".pageAccount .highestWpm .mode").html(topMode); $(".pageAccount .testsTaken .val").text(testCount); diff --git a/public/js/script.js b/public/js/script.js index d421ba447..47ec37b20 100644 --- a/public/js/script.js +++ b/public/js/script.js @@ -525,7 +525,7 @@ function showResult(difficultyFailed = false) { }else{ let completedEvent = { wpm: stats.wpm, - rawWpm: stats.rawWpm, + rawWpm: stats.wpmRaw, correctChars: stats.correctChars + stats.spaces, incorrectChars: stats.incorrectChars, acc: stats.acc,