diff --git a/public/index.html b/public/index.html index 28f2fb39a..86375bee6 100644 --- a/public/index.html +++ b/public/index.html @@ -1530,6 +1530,15 @@
avg accuracy
(last 10 tests)
-
+
+
+
avg consistency
+
-
+
+
+
avg consistency
(last 10 tests)
+
-
+
info diff --git a/public/js/account.js b/public/js/account.js index 5d956b3d2..1eac1646f 100644 --- a/public/js/account.js +++ b/public/js/account.js @@ -761,6 +761,14 @@ function loadMoreLines() { } } + let consistency = result.consistency; + + if (consistency === undefined) { + consistency = "-"; + } else { + consistency += "%"; + } + $(".pageAccount .history table tbody").append(` ${result.wpm} @@ -768,6 +776,7 @@ function loadMoreLines() { ${result.acc}% ${result.correctChars} ${result.incorrectChars} + ${consistency} ${result.mode} ${result.mode2}${withpunc} ${icons} ${tagIcons} @@ -810,7 +819,9 @@ function refreshAccountPage() { let totalSeconds = 0; let totalSecondsFiltered = 0; - let tableEl = ""; + let totalCons = 0; + let totalCons10 = 0; + let consCount = 0; filteredResults = []; $(".pageAccount .history table tbody").empty(); @@ -935,9 +946,17 @@ function refreshAccountPage() { last10++; wpmLast10total += result.wpm; totalAcc10 += result.acc; + result.consistency !== undefined + ? (totalCons10 += result.consistency) + : 0; } testCount++; + if (result.consistency !== undefined) { + consCount++; + totalCons += result.consistency; + } + if (result.rawWpm != null) { if (rawWpm.last10Count < 10) { rawWpm.last10Count++; @@ -1038,6 +1057,21 @@ function refreshAccountPage() { Math.round(totalAcc10 / last10) + "%" ); + console.log(totalCons10); + console.log(last10); + + if (totalCons == 0 || totalCons == undefined) { + $(".pageAccount .avgCons .val").text("-"); + $(".pageAccount .avgCons10 .val").text("-"); + } else { + $(".pageAccount .avgCons .val").text( + Math.round(totalCons / consCount) + "%" + ); + $(".pageAccount .avgCons10 .val").text( + Math.round(totalCons10 / Math.min(last10, consCount)) + "%" + ); + } + $(".pageAccount .testsStarted .val").text(`${testCount + testRestarts}`); $(".pageAccount .testsCompleted .val").text(