add more stats to mobile profile

This commit is contained in:
larssand committed 2026-09-04 16:17:45 +02:00
1 parent 142c45be04
commit 4068cc7c19
13 files changed
+267 -22

No files matched your search

+8
View File
@@ -1,5 +1,12 @@
import { getDriverProfile, getDriverProfileReferences } from "./driver_profile_logic.js";
const PUBLIC_TRAINING_SECTIONS = ["progress", "achievements", "performance", "goals", "history"];
function normalizePublicTrainingVisibility(value) {
const source = value && typeof value === "object" ? value : {};
return Object.fromEntries(PUBLIC_TRAINING_SECTIONS.map((key) => [key, source[key] !== false]));
}
function getTrainingDriverIds(state, driverId, classId = "") {
const profile = getDriverProfile(state, driverId);
if (!profile) return getDriverProfileReferences(state, driverId);
@@ -77,6 +84,7 @@ export function normalizeTrainingState(training, { uid }) {
token: String(share?.token || "").trim(),
enabled: share?.enabled !== false,
createdAt: String(share?.createdAt || new Date().toISOString()),
visibility: normalizePublicTrainingVisibility(share?.visibility),
}))
.filter((share) => {
if (!share.driverId || share.token.length < 24 || seenShareDrivers.has(share.driverId)) return false;