Show session summary on hover over its LiveTrack marker
CI / check (push) Successful in 55s
CI / deploy (push) Successful in 23s

The track endpoint now merges the session summary into the marker's
GeoJSON properties (already computed for storage, just wasn't passed
through), and the marker gets the same hover-popup treatment GPX
points already have.
This commit is contained in:
randy committed 2026-09-06 22:32:44 +02:00
1 parent 0ee98d8f07
commit 55607aece9
2 files changed
+76 -6

No files matched your search

+10 -6
View File
@@ -258,7 +258,8 @@ module Maptool
rescue LiveTrackClient::FetchError => e
halt 502, json(error: "could not fetch track: #{e.message}")
end
LIVETRACK_STORE.set_summary(session["id"], LiveTrackClient.summarize(result))
summary = LiveTrackClient.summarize(result)
LIVETRACK_STORE.set_summary(session["id"], summary)
points = result.points
coordinates = points.filter_map { |p| p.dig("position", "lon") && p.dig("position", "lat") && [p["position"]["lon"], p["position"]["lat"]] }
@@ -272,11 +273,14 @@ module Maptool
{
type: "Feature",
geometry: { type: "Point", coordinates: coordinates.last },
properties: {
time: last["dateTime"],
speedMetersPerSec: last["speedMetersPerSec"],
heartRateBeatsPerMin: last["heartRateBeatsPerMin"],
},
# Merges the session summary in too — the point layer's hover
# popup (public/js/livetrack.js) reads it straight off here
# rather than needing a second fetch against /sessions.
properties: summary.merge(
"time" => last["dateTime"],
"speed_meters_per_sec" => last["speedMetersPerSec"],
"heart_rate_beats_per_min" => last["heartRateBeatsPerMin"]
),
},
]
)