mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-09 21:51:29 +08:00
added avg accuracy and acg accuracy over last tests
This commit is contained in:
parent
6b54131e89
commit
8ea12b7f58
2 changed files with 22 additions and 4 deletions
|
|
@ -452,6 +452,15 @@
|
|||
<div class="title">avg restarts<br>per completed test</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div></div>
|
||||
<div class="group avgAcc">
|
||||
<div class="title">avg accuracy</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div class="group avgAcc10">
|
||||
<div class="title">avg accuracy<br>(last 10 tests)</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<!-- <div class="group favouriteTest">
|
||||
<div class="title">favourite test</div>
|
||||
<div class="val">words 10</div>
|
||||
|
|
|
|||
|
|
@ -395,8 +395,12 @@ function refreshAccountPage() {
|
|||
let totalWpm = 0;
|
||||
let testCount = 0;
|
||||
|
||||
let last10 = 0;
|
||||
let wpmLast10total = 0;
|
||||
let wpmLast10count = 0;
|
||||
|
||||
let totalAcc = 0;
|
||||
let totalAcc10 = 0;
|
||||
|
||||
$(".pageAccount .history table tbody").empty();
|
||||
dbSnapshot.forEach(result => {
|
||||
// console.log(result);
|
||||
|
|
@ -429,12 +433,14 @@ function refreshAccountPage() {
|
|||
}
|
||||
if(!activeFilters.includes(puncfilter)) return;
|
||||
|
||||
if(wpmLast10count < 10){
|
||||
wpmLast10count++;
|
||||
if(last10 < 10){
|
||||
last10++;
|
||||
wpmLast10total += result.wpm;
|
||||
totalAcc10 += result.acc;
|
||||
}
|
||||
testCount++;
|
||||
|
||||
totalAcc += result.acc;
|
||||
|
||||
if (result.restartCount != undefined) {
|
||||
testRestarts += result.restartCount;
|
||||
|
|
@ -507,10 +513,13 @@ function refreshAccountPage() {
|
|||
|
||||
$(".pageAccount .highestWpm .val").text(topWpm);
|
||||
$(".pageAccount .averageWpm .val").text(Math.round(totalWpm/testCount));
|
||||
$(".pageAccount .averageWpm10 .val").text(Math.round(wpmLast10total/wpmLast10count));
|
||||
$(".pageAccount .averageWpm10 .val").text(Math.round(wpmLast10total/last10));
|
||||
$(".pageAccount .highestWpm .mode").html(topMode);
|
||||
$(".pageAccount .testsTaken .val").text(testCount);
|
||||
|
||||
$(".pageAccount .avgAcc .val").text(Math.round(totalAcc/testCount)+"%");
|
||||
$(".pageAccount .avgAcc10 .val").text(Math.round(totalAcc10/last10)+"%");
|
||||
|
||||
$(".pageAccount .testsStarted .val").text(
|
||||
`${testCount + testRestarts}`
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue