Driving menu Trip: the stops as big rows (look, ✓ passed, ↑ ↓, ✕), a stop at the crosshair, the start at the car, search of saved points and offline places; each leg's km and time (legs_s) and the total, in the route panel too; passed stops kept (not routed, dimmed, editable) — a reroute marks them instead of dropping them; /status.html: every status endpoint full width (the debug panel links it); the trip-as-plan-and-log model and planned-vs-driven colors in docs/TODO
CI / check (push) Successful in 22s
CI / deploy (push) Successful in 17s

This commit is contained in:
randy committed 2026-12-01 02:21:14 +01:00
1 parent 0eb9d05cdc
commit 809e88ab1a
14 files changed
+517 -101

No files matched your search

+2 -1
View File
@@ -126,12 +126,13 @@ class RoutingTest < Minitest::Test
def test_route_picks_the_costing_by_weight_and_returns_a_line
shape = "wdg|xA{ubdQc@w@"
reply = JSON.generate(trip: { summary: { length: 1.5, time: 90 },
legs: [{ shape: shape, maneuvers: [{ instruction: "Drive north.", length: 1.5, type: 2, street_names: ["Main"] }] }] })
legs: [{ shape: shape, summary: { length: 1.5, time: 90 }, maneuvers: [{ instruction: "Drive north.", length: 1.5, type: 2, street_names: ["Main"] }] }] })
# The per-country lookup failing (400) leaves the route as it is.
request = serve_once("HTTP/1.1 200 OK\r\nContent-Length: #{reply.bytesize}\r\n\r\n#{reply}", "HTTP/1.1 400 Bad Request\r\nContent-Length: 2\r\n\r\n{}") do |url|
route = Maptool::Routing.route(url, [[9.52, 47.14], [9.53, 47.15]], Maptool::Routing::DEFAULT_VEHICLES[1])
assert_equal [2, "auto", "Drive north."], [route[:geometry][:coordinates].size, route[:properties][:costing], route[:properties][:maneuvers][0][:text]]
assert_equal({ text: "Drive north.", km: 1.5, type: 2, street: "Main" }, route[:properties][:maneuvers][0])
assert_equal [[1.5], [90]], route[:properties].values_at(:legs_km, :legs_s) # each leg's km and time, for the stops
end
assert_includes request, %("costing_options":{"auto":{"height":3.0,"width":2.3}})
+19 -1
View File
@@ -42,13 +42,31 @@ class TripTest < Minitest::Test
3.times { |i| store.follow([17.15, 48.01], speed: 20, now: i + 1, &router) } # ~1.1 km off
Timeout.timeout(5) { sleep 0.05 until store.get[:version] == 2 }
assert_equal [[[17.15, 48.01], [17.2, 48.0]]], calls
assert_equal "My position", store.get[:points][0][:name]
# the start and the via reached: kept, marked passed; the detour starts here
assert_equal [[true, nil], [true, nil], [false, "My position"], [false, nil]], store.get[:points].map { |p| p.values_at(:passed, :name) }
store.follow([17.15, 48.02], speed: 20, now: 5, &router) # within REROUTE_EVERY_S: nothing
assert_equal 1, calls.size
end
end
# A passed point stays in the trip, not in the route; marking one passed
# routes again (fewer locations), only renaming it doesn't.
def test_passed_points_are_kept_but_not_routed
Dir.mktmpdir do |dir|
store = Maptool::TripStore.new(File.join(dir, "trip.json"))
calls = []
router = ->(locations, *) { calls << locations; :route }
points = [{ lngLat: [1, 1], passed: true }, { lngLat: [2, 2] }, { lngLat: [3, 3] }]
trip = store.update(points: points, vehicle: nil, avoid: {}, editing: nil, &router)
assert_equal [[[2.0, 2.0], [3.0, 3.0]]], calls
assert_equal [true, false, false], trip[:points].map { |p| p[:passed] }
points[0] = points[0].merge(name: "Missed it")
store.update(points: points, vehicle: nil, avoid: {}, editing: nil, &router)
assert_equal 1, calls.size
end
end
def test_a_routing_error_is_kept_with_the_points_and_tried_again_next_time
Dir.mktmpdir do |dir|
store = Maptool::TripStore.new(File.join(dir, "trip.json"))