Fix Weather API access
This commit is contained in:
parent
9f13e89632
commit
b5164c9617
4 changed files with 11 additions and 3 deletions
|
|
@ -27,9 +27,15 @@ public class ActivityMetrics {
|
||||||
@JoinColumn(name = "activity_id", nullable = false)
|
@JoinColumn(name = "activity_id", nullable = false)
|
||||||
private Activity activity;
|
private Activity activity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Average speed in km/h (converted from m/s in FitParser/GpxParser).
|
||||||
|
*/
|
||||||
@Column(name = "average_speed", precision = 8, scale = 2)
|
@Column(name = "average_speed", precision = 8, scale = 2)
|
||||||
private BigDecimal averageSpeed;
|
private BigDecimal averageSpeed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Maximum speed in km/h (converted from m/s in FitParser/GpxParser).
|
||||||
|
*/
|
||||||
@Column(name = "max_speed", precision = 8, scale = 2)
|
@Column(name = "max_speed", precision = 8, scale = 2)
|
||||||
private BigDecimal maxSpeed;
|
private BigDecimal maxSpeed;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ public class ParsedActivityData {
|
||||||
private Integer heartRate;
|
private Integer heartRate;
|
||||||
private Integer cadence;
|
private Integer cadence;
|
||||||
private Integer power;
|
private Integer power;
|
||||||
|
/** Speed in km/h (converted from m/s in FitParser/GpxParser). */
|
||||||
private BigDecimal speed;
|
private BigDecimal speed;
|
||||||
private BigDecimal temperature;
|
private BigDecimal temperature;
|
||||||
private BigDecimal distance;
|
private BigDecimal distance;
|
||||||
|
|
|
||||||
|
|
@ -194,8 +194,8 @@ function createActivityMap(containerId, geoJsonData, options = {}) {
|
||||||
popupContent += `<strong>Heart Rate:</strong> ${props.heartRate} bpm<br>`;
|
popupContent += `<strong>Heart Rate:</strong> ${props.heartRate} bpm<br>`;
|
||||||
}
|
}
|
||||||
if (props.speed !== undefined) {
|
if (props.speed !== undefined) {
|
||||||
const speedKmh = props.speed * 3.6;
|
// Speed is already in km/h from backend (converted in FitParser)
|
||||||
popupContent += `<strong>Speed:</strong> ${speedKmh.toFixed(2)} km/h<br>`;
|
popupContent += `<strong>Speed:</strong> ${props.speed.toFixed(2)} km/h<br>`;
|
||||||
}
|
}
|
||||||
if (props.elevation !== undefined) {
|
if (props.elevation !== undefined) {
|
||||||
popupContent += `<strong>Elevation:</strong> ${props.elevation.toFixed(1)} m<br>`;
|
popupContent += `<strong>Elevation:</strong> ${props.elevation.toFixed(1)} m<br>`;
|
||||||
|
|
|
||||||
|
|
@ -487,9 +487,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Additional Metrics (conditional)
|
// Additional Metrics (conditional)
|
||||||
|
// Note: averageSpeed is already in km/h from backend (converted in FitParser)
|
||||||
if (activity.averageSpeed) {
|
if (activity.averageSpeed) {
|
||||||
document.getElementById('metricAvgSpeedContainer').style.display = 'block';
|
document.getElementById('metricAvgSpeedContainer').style.display = 'block';
|
||||||
document.getElementById('metricAvgSpeed').textContent = (activity.averageSpeed * 3.6).toFixed(1) + ' km/h';
|
document.getElementById('metricAvgSpeed').textContent = parseFloat(activity.averageSpeed).toFixed(1) + ' km/h';
|
||||||
}
|
}
|
||||||
if (activity.averageHeartRate) {
|
if (activity.averageHeartRate) {
|
||||||
document.getElementById('metricAvgHRContainer').style.display = 'block';
|
document.getElementById('metricAvgHRContainer').style.display = 'block';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue