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
This commit is contained in:
1 parent
0eb9d05cdc
commit
809e88ab1a
14 files changed
+517
-101
No files matched your search
+19
-1
@@ -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"))
|
||||
|
||||
Reference in new issue
Block a user