mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-12 23:20:25 +08:00
added consistency to the account page
This commit is contained in:
parent
f356dd5dd0
commit
1eff9dda46
2 changed files with 45 additions and 1 deletions
public
|
@ -1530,6 +1530,15 @@
|
|||
<div class="title">avg accuracy<br>(last 10 tests)</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div></div>
|
||||
<div class="group avgCons">
|
||||
<div class="title">avg consistency</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div class="group avgCons10">
|
||||
<div class="title">avg consistency<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>
|
||||
|
@ -1548,6 +1557,7 @@
|
|||
<td>accuracy</td>
|
||||
<td>correct<br>chars</td>
|
||||
<td>incorrect<br>chars</td>
|
||||
<td>consistency</td>
|
||||
<td>mode</td>
|
||||
<!-- <td>punctuation</td> -->
|
||||
<td>info</td>
|
||||
|
|
|
@ -761,6 +761,14 @@ function loadMoreLines() {
|
|||
}
|
||||
}
|
||||
|
||||
let consistency = result.consistency;
|
||||
|
||||
if (consistency === undefined) {
|
||||
consistency = "-";
|
||||
} else {
|
||||
consistency += "%";
|
||||
}
|
||||
|
||||
$(".pageAccount .history table tbody").append(`
|
||||
<tr>
|
||||
<td>${result.wpm}</td>
|
||||
|
@ -768,6 +776,7 @@ function loadMoreLines() {
|
|||
<td>${result.acc}%</td>
|
||||
<td>${result.correctChars}</td>
|
||||
<td>${result.incorrectChars}</td>
|
||||
<td>${consistency}</td>
|
||||
<td>${result.mode} ${result.mode2}${withpunc}</td>
|
||||
<td class="infoIcons">${icons}</td>
|
||||
<td>${tagIcons}</td>
|
||||
|
@ -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(
|
||||
|
|
Loading…
Reference in a new issue