fix(analytics): show highest elevation gain in meters
Signed-off-by: Marcus Fihlon <marcus@fihlon.swiss>
This commit is contained in:
parent
c84377b05a
commit
4df5af63e0
2 changed files with 9 additions and 0 deletions
|
|
@ -317,6 +317,9 @@
|
||||||
}
|
}
|
||||||
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||||
} else if (unit === 'meters') {
|
} else if (unit === 'meters') {
|
||||||
|
if (type === 'HIGHEST_ELEVATION_GAIN') {
|
||||||
|
return `${Math.round(value)} m`;
|
||||||
|
}
|
||||||
return `${(value / 1000).toFixed(2)} km`;
|
return `${(value / 1000).toFixed(2)} km`;
|
||||||
} else if (unit === 'mps') {
|
} else if (unit === 'mps') {
|
||||||
return `${(value * 3.6).toFixed(2)} km/h`;
|
return `${(value * 3.6).toFixed(2)} km/h`;
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,9 @@
|
||||||
}
|
}
|
||||||
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
return `${minutes}:${seconds.toString().padStart(2, '0')}`;
|
||||||
} else if (unit === 'meters') {
|
} else if (unit === 'meters') {
|
||||||
|
if (type === 'HIGHEST_ELEVATION_GAIN') {
|
||||||
|
return `${Math.round(value)} m`;
|
||||||
|
}
|
||||||
return `${(value / 1000).toFixed(2)} km`;
|
return `${(value / 1000).toFixed(2)} km`;
|
||||||
} else if (unit === 'mps') {
|
} else if (unit === 'mps') {
|
||||||
return `${(value * 3.6).toFixed(2)} km/h`;
|
return `${(value * 3.6).toFixed(2)} km/h`;
|
||||||
|
|
@ -226,6 +229,9 @@
|
||||||
const diff = current - previous;
|
const diff = current - previous;
|
||||||
const percentImprove = (diff / previous * 100).toFixed(1);
|
const percentImprove = (diff / previous * 100).toFixed(1);
|
||||||
if (pr.unit === 'meters') {
|
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)`;
|
return `${(diff / 1000).toFixed(2)} km more (${percentImprove}% improvement)`;
|
||||||
} else if (pr.unit === 'mps') {
|
} else if (pr.unit === 'mps') {
|
||||||
return `${(diff * 3.6).toFixed(2)} km/h faster (${percentImprove}% improvement)`;
|
return `${(diff * 3.6).toFixed(2)} km/h faster (${percentImprove}% improvement)`;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue