mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-02 12:00:10 +08:00
limiting results to 1000, reading stats from db
This commit is contained in:
parent
726f834a60
commit
993b4370ef
3 changed files with 45 additions and 15 deletions
|
@ -2345,6 +2345,20 @@
|
|||
<canvas id="hoverChart"></canvas>
|
||||
</div>
|
||||
<div class="hoverChartBg"></div>
|
||||
<div class="triplegroup">
|
||||
<div class="group globalTestsStarted">
|
||||
<div class="title">tests started</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div class="group globalTestsCompleted">
|
||||
<div class="title">tests completed</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div class="group globalTimeTyping" style="margin-bottom: 2rem;">
|
||||
<div class="title">time typing</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="group filterButtons">
|
||||
<div
|
||||
class="button"
|
||||
|
@ -2448,19 +2462,6 @@
|
|||
<div class="below"></div>
|
||||
</div>
|
||||
<div class="triplegroup stats">
|
||||
<div class="text" style="margin-bottom: 2rem;">
|
||||
estimated total
|
||||
<br />
|
||||
time spent typing
|
||||
</div>
|
||||
<div class="group timeTotal" style="margin-bottom: 2rem;">
|
||||
<div class="title">overall</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div class="group timeTotalFiltered">
|
||||
<div class="title">filtered</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div class="group highestWpm">
|
||||
<div class="title">highest wpm</div>
|
||||
<div class="val">-</div>
|
||||
|
@ -2498,11 +2499,16 @@
|
|||
</div>
|
||||
|
||||
<div class="group testsStarted">
|
||||
<div class="title">tests started</div>
|
||||
<div class="title">
|
||||
tests started
|
||||
</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div class="group testsCompleted">
|
||||
<div class="title">tests completed</div>
|
||||
<div class="title">
|
||||
tests completed
|
||||
<span data-balloon-length="xlarge" aria-label="Due to the increasing number of results in the database, you can now only see your last 1000 results in detail. Total time spent typing, started and completed tests stats will still be up to date at the top of the page, above the filters." data-balloon-pos="up"><i class="fas fa-question-circle"></i></span>
|
||||
</div>
|
||||
<div class="val">-</div>
|
||||
</div>
|
||||
<div class="group avgRestart">
|
||||
|
|
|
@ -1344,11 +1344,26 @@ function loadMoreLines() {
|
|||
}
|
||||
}
|
||||
|
||||
function refreshGlobalStats() {
|
||||
let th = Math.floor(dbSnapshot.globalStats.time / 3600);
|
||||
let tm = Math.floor((dbSnapshot.globalStats.time % 3600) / 60);
|
||||
let ts = Math.floor((dbSnapshot.globalStats.time % 3600) % 60);
|
||||
$(".pageAccount .globalTimeTyping .val").text(`
|
||||
|
||||
${th < 10 ? "0" + th : th}:${tm < 10 ? "0" + tm : tm}:${
|
||||
ts < 10 ? "0" + ts : ts
|
||||
}
|
||||
`);
|
||||
$(".pageAccount .globalTestsStarted .val").text(dbSnapshot.globalStats.started);
|
||||
$(".pageAccount .globalTestsCompleted .val").text(dbSnapshot.globalStats.completed);
|
||||
}
|
||||
|
||||
let totalSecondsFiltered = 0;
|
||||
|
||||
function refreshAccountPage() {
|
||||
function cont() {
|
||||
refreshThemeColorObject();
|
||||
refreshGlobalStats();
|
||||
|
||||
let chartData = [];
|
||||
visibleTableLines = 0;
|
||||
|
@ -1474,6 +1489,9 @@ function refreshAccountPage() {
|
|||
//tag valid, check if filter is on
|
||||
// if (activeFilters.includes("tag_" + tag)) tagHide = false;
|
||||
if (config.resultFilters.tags[tag]) tagHide = false;
|
||||
} else {
|
||||
//tag not found in valid tags, meaning probably deleted
|
||||
if (config.resultFilters.tags.none) tagHide = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -67,6 +67,11 @@ async function db_getUserSnapshot() {
|
|||
snap.config = data.config;
|
||||
snap.favouriteThemes =
|
||||
data.favouriteThemes === undefined ? [] : data.favouriteThemes;
|
||||
snap.globalStats = {
|
||||
time: data.timeTyping,
|
||||
started: data.startedTests,
|
||||
completed: data.completedTests
|
||||
}
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
|
@ -93,6 +98,7 @@ async function db_getUserResults() {
|
|||
return await db
|
||||
.collection(`users/${user.uid}/results/`)
|
||||
.orderBy("timestamp", "desc")
|
||||
.limit(1000)
|
||||
.get()
|
||||
.then((data) => {
|
||||
dbSnapshot.results = [];
|
||||
|
|
Loading…
Reference in a new issue