fix(roadtrip): the connection built by a day window is a connection too

The last change marked the drive into the next day and kept it off a phone stage, but it
only caught the connection `connectDays` builds through `inboundAt`. A trip with a day
window set never takes that path: the window switches `inboundAt` off and builds the days
itself, so day 2 opens on an automatic night standing where day 1 stopped and its first
leg is the drive on from there. That leg is the same connection, it just arrives as one
of day 2's own legs under day 2's number, and the stage drew the whole way back to
yesterday's last stop on today's map. The setting is not even involved: with a window it
happens either way.

So the leg out of an opening night is marked as a join as well, and the phone drops it
with the rest.

One exception, because the filter must not empty the screen: a day that is nothing but
driving, night to night with no stop of its own, has only the connection to show, and
there the line IS the day. When dropping the joins would leave a stage with no line at
all, it keeps them.
This commit is contained in:
Maurice
2026-09-17 13:55:56 +02:00
parent c0ff4dabb3
commit 84923b97a7
4 changed files with 71 additions and 3 deletions
@@ -135,6 +135,14 @@ describe('stageMapData with a stage', () => {
expect(stageMapData(withJoin, stage, true).lines).toEqual([LINES[1]])
})
it('FE-RTSTAGE-020: a day that is nothing but driving keeps its connection rather than going blank', () => {
// Night to night, no stop of its own: the connection is the only line the day has, and
// the line IS the day. Better a map that shows the drive than an empty one.
const onlyJoin = routes({ lineDays: [1, 2, 3, 3], lineJoins: [false, true, false, false] })
expect(stageMapData(onlyJoin, stage, true).lines).toEqual([LINES[1]])
})
it('FE-RTSTAGE-017: the colours still line up once a join has been dropped', () => {
const data = stageMapData(routes({ lineJoins: [false, false, true, false] }), stage, true)
+7 -2
View File
@@ -59,8 +59,13 @@ export function stageMapData(
// was the longest thing on screen. The desktop has the same connection, but it has it
// beside every other day, which is the view the setting exists for; here that view is
// the "all days" one, a tap away on the same map.
const keep: number[] = []
routes.lineDays.forEach((n, i) => { if (n === stage.dayNumber && !routes.lineJoins?.[i]) keep.push(i) })
const ofDay: number[] = []
routes.lineDays.forEach((n, i) => { if (n === stage.dayNumber) ofDay.push(i) })
const own = ofDay.filter(i => !routes.lineJoins?.[i])
// A day that is nothing but driving — no stop of its own, night to night — has only the
// connection to show. Dropping it there would leave the map blank on the very day the
// line IS the day, so the filter gives way rather than emptying the screen.
const keep = own.length ? own : ofDay
const placeIds = stagePlaceIds(stage)
return {