fix(transit): prefer displayName for the line identifier (#1715)

Transitous exposes routeShortName, which many operators — German long
distance among them — do not fill. displayName carries the identifier
passengers actually see, with routeShortName as the fallback.
This commit is contained in:
Maurice
2026-07-29 14:38:01 +02:00
committed by Maurice
parent 4f99834965
commit f35c3f31e2
2 changed files with 43 additions and 1 deletions
+5 -1
View File
@@ -302,7 +302,11 @@ export async function plan(q: PlanQuery): Promise<{ itineraries: TransitItinerar
duration: typeof leg.duration === 'number' ? leg.duration : 0,
distance: typeof leg.distance === 'number' ? Math.round(leg.distance) : null,
headsign: leg.headsign || null,
line: leg.routeShortName || leg.displayName || null,
// displayName is the public identifier MOTIS resolved for the run, taking
// the trip number into account where the feed has one. Plenty of operators
// (German long distance among them) keep routeShortName as an internal line
// number, so preferring it showed "20" instead of "ICE 72" (#1715).
line: leg.displayName || leg.routeShortName || null,
lineColor: safeColor(leg.routeColor),
lineTextColor: safeColor(leg.routeTextColor),
agency: leg.agencyName || null,