Planning (the Design canvas' Plan and GridToday, ideas from azedler/roadplanner): a stop's type as its NPS pictogram (marker and list), notes on the trip, its days and stops, + on a leg inserts the next point there; a parking spot per stop (P marker, the route goes there, the walk shown); a link pasted into the search becomes a place (/api/link: the URL's coordinates, else the page's geo meta / JSON-LD / a map link; public addresses only, logged in), added on the leg it lengthens least; avoids for the trip (+ ferries, unpaved) or a day (routed in pieces, joined); Check and Costs folds in the Route panel (no leave time, long days, arriving after sunset, long walks, missing vignettes; fuel from km × consumption × price, stop costs / paid, the budget); Today in drive mode's Menu (stops left, tonight, sunset, Open-Meteo weather, the day's notes, Skip next, Tomorrow). Plugins along the trip's route (Maptool::Corridor, a corridor width; Overpass around:) and plugin settings saved server-side; p4n via a host Firefox's cookies (docs/deployment.adoc). The recording's days (cut where the car stood ≥ 4 h, or by hand) and their export (days, a piece A–B, the whole trip; GPX with times). Track replay in the GNSS simulator. Step advance 5 m past a maneuver. The level gauge (drive mode, from Terrain): lift per wheel to the ramps' steps from roll, pitch, wheelbase and track
CI / check (push) Successful in 23s
CI / deploy (push) Successful in 18s

This commit is contained in:
randy committed 2026-12-03 23:34:25 +01:00
1 parent 5e31dfaba9
commit 87d7bd2463
36 files changed
+2047 -123

No files matched your search

+43
View File
@@ -0,0 +1,43 @@
require_relative "test_helper"
require "maptool/trip_days"
class TripDaysTest < Minitest::Test
D = Maptool::TripDays
# A drive: a point a minute from `start` (local time), `n` of them, going north.
def drive(start, n, lat0 = 48.0)
t0 = Time.new(*start).to_f
(0...n).map { |i| [17.0, lat0 + i * 0.01, 100.0 + i, t0 + i * 60] }
end
def test_a_night_stood_cuts_a_day_and_a_night_drive_cuts_at_three
points = drive([2026, 12, 1, 18, 0], 60) + drive([2026, 12, 2, 8, 0], 30, 49.0) # stood 13 h
assert_equal [[60, "auto"]], D.cuts(points)
night = drive([2026, 12, 1, 23, 0], 300) # through the night, no stop
assert_equal [[240, "night"]], D.cuts(night) # 23:00 + 240 min = 03:00
end
def test_cuts_by_hand_and_joined
points = drive([2026, 12, 1, 10, 0], 60) + drive([2026, 12, 1, 20, 0], 10, 49.0)
hand = points[30][3] - 20 # between two points: the day starts at the next one
cuts = D.cuts(points, hand: [hand])
assert_equal [[30, "hand"], [60, "auto"]], cuts
assert_equal [[30, "hand"]], D.cuts(points, hand: [hand], joined: [points[60][3]])
days = D.days(points, cuts)
assert_equal [1, 2, 3], days.map { |d| d[:index] }
assert_equal [0, 30, 60], days.map { |d| d[:from] }
assert_equal "auto", days[1][:cut][:kind]
assert_equal 9 * 3600 + 60, days[1][:cut][:stood_s] # from 10:59 to 20:00
assert_in_delta 29 * 60, days[0][:driving_s], 1
assert_nil days.last[:cut]
end
def test_gpx_has_a_track_per_piece_with_times_and_pauses
points = drive([2026, 12, 1, 10, 0], 3) + drive([2026, 12, 1, 11, 0], 3, 48.1)
gpx = D.gpx([["Day 1", points.first(3)], ["Day 2", points.last(3)]], D.pauses(points))
assert_equal 2, gpx.scan("<trk>").size
assert_includes gpx, "<time>#{Time.at(points[0][3]).utc.iso8601}</time>"
assert_includes gpx, "Stood 58 min"
end
end