mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-17 22:29:52 +08:00
changed the way char stats are stored and displayed
This commit is contained in:
parent
9ca113b087
commit
0448a425d4
5 changed files with 35 additions and 22 deletions
|
|
@ -176,7 +176,15 @@ async function migrateUsers() {
|
|||
if (resultData.tags && resultData.tags.length > 0) {
|
||||
resultData.tags = resultData.tags.map((tag) => tagPairs[tag]);
|
||||
}
|
||||
newStats.completedTests++;
|
||||
if (!resultData.charStats) {
|
||||
resultData.charStats = [
|
||||
resultData.correctChars,
|
||||
resultData.incorrectChars,
|
||||
];
|
||||
}
|
||||
delete resultData.correctChars;
|
||||
delete resultData.incorrectChars;
|
||||
resultData.charStats = newStats.completedTests++;
|
||||
if (resultData.restartCount) {
|
||||
newStats.startedTests += resultData.restartCount + 1;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -285,15 +285,21 @@ function loadMoreLines(lineIndex) {
|
|||
pb = "";
|
||||
}
|
||||
|
||||
let charStats = "-";
|
||||
if (result.charStats) {
|
||||
charStats = result.charStats.join("/");
|
||||
} else {
|
||||
charStats = result.correctChars + "/" + result.incorrectChars + "/-/-";
|
||||
}
|
||||
|
||||
$(".pageAccount .history table tbody").append(`
|
||||
<tr class="resultRow" id="result-${i}">
|
||||
<td>${pb}</td>
|
||||
<td>${result.wpm.toFixed(2)}</td>
|
||||
<td>${raw}</td>
|
||||
<td>${result.acc.toFixed(2)}%</td>
|
||||
<td>${result.correctChars}</td>
|
||||
<td>${result.incorrectChars}</td>
|
||||
<td>${consistency}</td>
|
||||
<td>${charStats}</td>
|
||||
<td>${result.mode} ${result.mode2}${withpunc}</td>
|
||||
<td class="infoIcons">${icons}</td>
|
||||
<td>${tagIcons}</td>
|
||||
|
|
|
|||
|
|
@ -138,6 +138,9 @@ export async function getUserResults() {
|
|||
if (result.numbers === undefined) result.numbers = false;
|
||||
if (result.punctuation === undefined) result.punctuation = false;
|
||||
});
|
||||
results.data = results.data.sort((a, b) => {
|
||||
return a.timestamp < b.timestamp;
|
||||
});
|
||||
dbSnapshot.results = results.data;
|
||||
await TodayTracker.addAllFromToday();
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1479,9 +1479,15 @@ export function finish(difficultyFailed = false) {
|
|||
let completedEvent = {
|
||||
wpm: stats.wpm,
|
||||
rawWpm: stats.wpmRaw,
|
||||
correctChars: stats.correctChars + stats.correctSpaces,
|
||||
incorrectChars: stats.incorrectChars,
|
||||
allChars: stats.allChars,
|
||||
// correctChars: stats.correctChars + stats.correctSpaces,
|
||||
// incorrectChars: stats.incorrectChars,
|
||||
// allChars: stats.allChars,
|
||||
charStats: [
|
||||
stats.correctChars + stats.correctSpaces,
|
||||
stats.incorrectChars,
|
||||
stats.extraChars,
|
||||
stats.missedChars,
|
||||
],
|
||||
acc: stats.acc,
|
||||
mode: Config.mode,
|
||||
mode2: mode2,
|
||||
|
|
|
|||
|
|
@ -4394,28 +4394,18 @@
|
|||
<td type="button" class="sortable history-acc-header">
|
||||
accuracy
|
||||
</td>
|
||||
<td
|
||||
type="button"
|
||||
class="sortable history-correct-chars-header"
|
||||
>
|
||||
correct
|
||||
<br />
|
||||
chars
|
||||
</td>
|
||||
<td
|
||||
type="button"
|
||||
class="sortable history-incorrect-chars-header"
|
||||
>
|
||||
incorrect
|
||||
<br />
|
||||
chars
|
||||
</td>
|
||||
<td
|
||||
type="button"
|
||||
class="sortable history-consistency-header"
|
||||
>
|
||||
consistency
|
||||
</td>
|
||||
<td
|
||||
aria-label="correct/incorrect/extra/missed"
|
||||
data-balloon-pos="up"
|
||||
>
|
||||
chars
|
||||
</td>
|
||||
<td>mode</td>
|
||||
<!-- <td>punctuation</td> -->
|
||||
<td>info</td>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue