Fix: elevation chart empty after 'Уточнить высоты' (read srtm, not just gps)

showSessionDetail's elevation profile, min/max, x-labels and point popup read
only altitude_gps_m, but 'Уточнить высоты (онлайн)' writes altitude_srtm_m
(computeStats already prefers srtm — hence stats updated but the chart stayed
empty). Read altitude_srtm_m ?? altitude_gps_m everywhere the detail shows
elevation, matching computeStats. No regression: no srtm -> falls back to gps.
This commit is contained in:
4aiman 2026-08-22 14:23:06 +03:00
commit c1f063ded5
4 changed files with 8 additions and 6 deletions

View file

@ -4247,7 +4247,9 @@ async function showSessionDetail(sessionId) {
let graphMaxSpeed = smoothed.length ? Math.max(...smoothed) : 0;
// Elevation data
let elevations = GPS.filterAndSmoothAlt(points.map(p => p.altitude_gps_m));
// Prefer refined terrain altitude (srtm, written by "Уточнить высоты") over raw
// GPS altitude — same priority computeStats uses, so the chart matches the stats.
let elevations = GPS.filterAndSmoothAlt(points.map(p => p.altitude_srtm_m ?? p.altitude_gps_m));
let minElev = elevations.length ? Math.round(Math.min(...elevations)) : null;
let maxElev = elevations.length ? Math.round(Math.max(...elevations)) : null;
@ -4546,7 +4548,7 @@ async function showSessionDetail(sessionId) {
// Invisible but tappable hit-targets on top of track
for (let i = 0; i < points.length; i++) {
let p = points[i];
let alt = p.altitude_gps_m ?? p.altitude;
let alt = p.altitude_srtm_m ?? p.altitude_gps_m ?? p.altitude;
let spd = p.speed_ms != null ? (p.speed_ms * 3.6).toFixed(1) + " km/h" : "";
let time = p.ts.split("T")[1].slice(0, 8);
let hr = p.heart_rate ? `${p.heart_rate} bpm` : "";
@ -4662,7 +4664,7 @@ async function showSessionDetail(sessionId) {
let dsTimeLabels = downsample(timeLabels, MAX_CHART_PTS);
let dsElevations = downsample(elevations, MAX_CHART_PTS);
let dsElevLabels = downsample(
points.filter(p => p.altitude_gps_m != null).map(p => ((new Date(p.ts).getTime() - t0) / 60000).toFixed(1)),
points.filter(p => (p.altitude_srtm_m ?? p.altitude_gps_m) != null).map(p => ((new Date(p.ts).getTime() - t0) / 60000).toFixed(1)),
MAX_CHART_PTS
);

2
src-tauri/Cargo.lock generated
View file

@ -139,7 +139,7 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
[[package]]
name = "baldav"
version = "0.1.409"
version = "0.1.411"
dependencies = [
"base64 0.22.1",
"btleplug",

View file

@ -1,6 +1,6 @@
[package]
name = "baldav"
version = "0.1.409"
version = "0.1.411"
edition = "2021"
[lib]

View file

@ -1,7 +1,7 @@
{
"$schema": "https://raw.githubusercontent.com/nicegui/tauri-v2/refs/heads/main/tooling/cli/schema.json",
"productName": "BalDav",
"version": "0.1.409",
"version": "0.1.411",
"identifier": "dev.baldav.app",
"build": {
"frontendDist": "../frontend"