add stat
This commit is contained in:
1 parent
355a1ad3b0
commit
3aeb77a042
13 files changed
+642
-8
No files matched your search
@@ -52,6 +52,11 @@ const messages = {
|
||||
updated: "Uppdaterad {time}",
|
||||
switchCue: "Byt till kontrollerad körning",
|
||||
finishCue: "Träningspasset är klart",
|
||||
performance: "Stintstatistik",
|
||||
stints: "Stints",
|
||||
bestThree: "Bästa 3 sammanhängande",
|
||||
bestFive: "Bästa 5 min",
|
||||
fiveAverage: "Avg pace, bästa 5 min",
|
||||
},
|
||||
en: {
|
||||
loading: "Loading training profile...",
|
||||
@@ -96,6 +101,11 @@ const messages = {
|
||||
updated: "Updated {time}",
|
||||
switchCue: "Switch to controlled driving",
|
||||
finishCue: "The training session is complete",
|
||||
performance: "Stint statistics",
|
||||
stints: "Stints",
|
||||
bestThree: "Best 3 consecutive",
|
||||
bestFive: "Best 5 min",
|
||||
fiveAverage: "Average pace, best 5 min",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -126,6 +136,15 @@ function formatLap(ms) {
|
||||
return `${minutes}:${String(seconds).padStart(2, "0")}.${String(millis).padStart(3, "0")}`;
|
||||
}
|
||||
|
||||
function formatRaceResultTime(ms) {
|
||||
const value = Math.max(0, Math.floor(Number(ms || 0)));
|
||||
const minutes = Math.floor(value / 60000);
|
||||
const seconds = Math.floor((value % 60000) / 1000);
|
||||
const centiseconds = Math.floor((value % 1000) / 10);
|
||||
const millis = Math.floor(value % 1000);
|
||||
return `${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}.${String(centiseconds).padStart(2, "0")}:${String(millis).padStart(3, "0")}`;
|
||||
}
|
||||
|
||||
function formatTimer(ms) {
|
||||
const seconds = Math.max(0, Math.ceil(ms / 1000));
|
||||
return `${String(Math.floor(seconds / 60)).padStart(2, "0")}:${String(seconds % 60).padStart(2, "0")}`;
|
||||
@@ -236,6 +255,16 @@ function renderProfile(data) {
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section class="profile-card profile-performance" style="margin-top:14px">
|
||||
<div class="profile-card-head"><h2>${escapeHtml(t("performance"))}</h2></div>
|
||||
<div class="profile-performance-stats">
|
||||
<div><span>${escapeHtml(t("stints"))}</span><strong>${Number(stats.stintCount || 0)}</strong></div>
|
||||
<div><span>${escapeHtml(t("bestThree"))}</span><strong>${stats.bestThreeConsecutive ? `3/${formatRaceResultTime(stats.bestThreeConsecutive.totalMs)}` : "-"}</strong></div>
|
||||
<div><span>${escapeHtml(t("bestFive"))}</span><strong>${stats.bestFiveMinuteResult ? `${stats.bestFiveMinuteResult.lapCount}/${formatRaceResultTime(stats.bestFiveMinuteResult.totalMs)}` : "-"}</strong></div>
|
||||
<div><span>${escapeHtml(t("fiveAverage"))}</span><strong>${stats.bestFiveMinuteResult ? formatLap(stats.bestFiveMinuteResult.averageLapMs) : "-"}</strong></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
${goals.length ? `
|
||||
<section class="profile-card" style="margin-top:14px">
|
||||
<div class="profile-card-head"><h2>${escapeHtml(t("goals"))}</h2></div>
|
||||
|
||||
Reference in new issue
Block a user