From 4df5af63e0cae2cad7fe4071b38955d35bcf0c1f Mon Sep 17 00:00:00 2001 From: Marcus Fihlon Date: Thu, 30 Apr 2026 12:59:26 +0200 Subject: [PATCH] fix(analytics): show highest elevation gain in meters Signed-off-by: Marcus Fihlon --- src/main/resources/templates/analytics/dashboard.html | 3 +++ .../resources/templates/analytics/personal-records.html | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/main/resources/templates/analytics/dashboard.html b/src/main/resources/templates/analytics/dashboard.html index 0f09a32..40bbd0c 100644 --- a/src/main/resources/templates/analytics/dashboard.html +++ b/src/main/resources/templates/analytics/dashboard.html @@ -317,6 +317,9 @@ } return `${minutes}:${seconds.toString().padStart(2, '0')}`; } else if (unit === 'meters') { + if (type === 'HIGHEST_ELEVATION_GAIN') { + return `${Math.round(value)} m`; + } return `${(value / 1000).toFixed(2)} km`; } else if (unit === 'mps') { return `${(value * 3.6).toFixed(2)} km/h`; diff --git a/src/main/resources/templates/analytics/personal-records.html b/src/main/resources/templates/analytics/personal-records.html index 7ff5ff6..0b32171 100644 --- a/src/main/resources/templates/analytics/personal-records.html +++ b/src/main/resources/templates/analytics/personal-records.html @@ -202,6 +202,9 @@ } return `${minutes}:${seconds.toString().padStart(2, '0')}`; } else if (unit === 'meters') { + if (type === 'HIGHEST_ELEVATION_GAIN') { + return `${Math.round(value)} m`; + } return `${(value / 1000).toFixed(2)} km`; } else if (unit === 'mps') { return `${(value * 3.6).toFixed(2)} km/h`; @@ -226,6 +229,9 @@ const diff = current - previous; const percentImprove = (diff / previous * 100).toFixed(1); if (pr.unit === 'meters') { + if (pr.recordType === 'HIGHEST_ELEVATION_GAIN') { + return `${Math.round(diff)} m more (${percentImprove}% improvement)`; + } return `${(diff / 1000).toFixed(2)} km more (${percentImprove}% improvement)`; } else if (pr.unit === 'mps') { return `${(diff * 3.6).toFixed(2)} km/h faster (${percentImprove}% improvement)`;