Profile: 1/5/10 km splits or laps (FIT/TCX) shaded in the charts, in the table and as numbered posts on the map; tooltip follows the pointer over the plots only
This commit is contained in:
1 parent
3e487539bc
commit
38368fc801
9 files changed
+292
-101
No files matched your search
+4
-1
@@ -159,11 +159,14 @@ class AppTest < Minitest::Test
|
||||
tcx = <<~XML
|
||||
<TrainingCenterDatabase xmlns="http://www.garmin.com/xmlschemas/TrainingCenterDatabase/v2"><Activities><Activity Sport="Biking"><Lap><Track>
|
||||
<Trackpoint><Time>2026-05-01T10:00:00Z</Time><Position><LatitudeDegrees>48.1</LatitudeDegrees><LongitudeDegrees>17.1</LongitudeDegrees></Position><AltitudeMeters>140</AltitudeMeters></Trackpoint>
|
||||
</Track></Lap><Lap><Track>
|
||||
<Trackpoint><Time>2026-05-01T10:01:00Z</Time><Position><LatitudeDegrees>48.11</LatitudeDegrees><LongitudeDegrees>17.1</LongitudeDegrees></Position><AltitudeMeters>150</AltitudeMeters></Trackpoint>
|
||||
</Track></Lap></Activity></Activities></TrainingCenterDatabase>
|
||||
XML
|
||||
key = json_body(upload("ride.tcx", tcx))["paths"].first
|
||||
assert_equal "cycling", json_body(request.get(node_url(key)))["features"][0]["properties"]["activity_type"]
|
||||
properties = json_body(request.get(node_url(key)))["features"][0]["properties"]
|
||||
assert_equal "cycling", properties["activity_type"]
|
||||
assert_equal [0, 1], properties["laps"]
|
||||
|
||||
fit = request.get("#{node_url(key)}?download=fit&name=Ride", **logged_in_env)
|
||||
assert_equal 200, fit.status
|
||||
|
||||
@@ -101,6 +101,20 @@ class FitTest < Minitest::Test
|
||||
assert_equal "cycling", geojson["features"][0]["properties"]["activity_type"]
|
||||
end
|
||||
|
||||
def test_laps_are_the_first_record_index_of_each_lap
|
||||
record_def = [0b01000000, 0, 0, 20, 3].pack("CCCS<C") + [253, 4, 0x86, 0, 4, 0x85, 1, 4, 0x85].pack("C*")
|
||||
lap_def = [0b01000001, 0, 0, 19, 1].pack("CCCS<C") + [2, 4, 0x86].pack("C*")
|
||||
body = record_def + lap_def
|
||||
body << [0b00000001].pack("C") << le32(1000) # lap 1 starts at t=1000
|
||||
body << [0b00000001].pack("C") << le32(1002) # lap 2 at t=1002
|
||||
4.times { |i| body << [0].pack("C") << le32(1000 + i) << le32(100_000_000 + i * 1000) << le32(200_000_000) }
|
||||
path = File.join(Dir.mktmpdir, "laps.fit")
|
||||
File.binwrite(path, [12, 16, 0, 0].pack("C2S<") + le32(body.bytesize) + ".FIT" + body + "\x00\x00")
|
||||
|
||||
assert_equal [0, 2], Maptool::Fit.to_geojson(path)["features"][0]["properties"]["laps"]
|
||||
assert_nil Maptool::Fit.to_geojson(write_fit([[1, 2], [3, 4]]))["features"][0]["properties"]["laps"]
|
||||
end
|
||||
|
||||
def test_activity_type_is_nil_without_a_session_message
|
||||
path = write_activity_fit([{ lat: 100_000_000, lon: 200_000_000 }])
|
||||
geojson = Maptool::Fit.to_geojson(path)
|
||||
|
||||
Reference in new issue
Block a user