From f7264b8f594859c1430bd13e765db03002842d38 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sun, 23 Aug 2026 11:18:06 +0200 Subject: Add normalized difficulty versus moving duration to analytics Extend analytics with a second scatter plotting Cotacol per 100 km against moving hours, keep speed versus Cotacol as first chart, render both canvases from shared points, open ride detail in a new tab on dot click, and keep all website copy in English. --- web/frontend/analytics-logic.ts | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'web/frontend/analytics-logic.ts') diff --git a/web/frontend/analytics-logic.ts b/web/frontend/analytics-logic.ts index 7a53944..e8a1559 100644 --- a/web/frontend/analytics-logic.ts +++ b/web/frontend/analytics-logic.ts @@ -33,3 +33,11 @@ const roundStep = (value: number): number => { export const formatSpeed = (speed: number): string => `${speed.toFixed(1)}`; export const formatCotacol = (cotacol: number): string => (cotacol >= 100 ? `${Math.round(cotacol)}` : `${cotacol.toFixed(1)}`); + +export const formatHours = (hours: number): string => { + if (hours < 1) return `${Math.round(hours * 60)}m`; + const h = Math.floor(hours); + const m = Math.round((hours - h) * 60); + if (m === 0) return `${h}h`; + return `${h}h${String(m).padStart(2, "0")}`; +}; -- cgit v1.3