leg.id -> leg.tripId 💥

This commit is contained in:
Jannis R 2018-11-21 23:42:13 +01:00
parent 2e12206c0b
commit 96ff59dc43
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 6 additions and 3 deletions

View file

@ -411,13 +411,16 @@ const createClient = (profile, userAgent, request = _request) => {
polylines: opt.polyline && d.common.polyL || [] polylines: opt.polyline && d.common.polyL || []
}) })
const leg = { // pretend the leg is contained in a journey const rawLeg = { // pretend the leg is contained in a journey
type: 'JNY', type: 'JNY',
dep: minBy(d.journey.stopL, 'idx'), dep: minBy(d.journey.stopL, 'idx'),
arr: maxBy(d.journey.stopL, 'idx'), arr: maxBy(d.journey.stopL, 'idx'),
jny: d.journey jny: d.journey
} }
return parse(d.journey, leg, !!opt.stopovers) const trip = parse(d.journey, rawLeg, !!opt.stopovers)
trip.id = trip.tripId
delete trip.tripId
return trip
}) })
} }

View file

@ -90,7 +90,7 @@ const createParseJourneyLeg = (profile, opt, data) => {
} }
} else if (pt.type === 'JNY') { } else if (pt.type === 'JNY') {
// todo: pull `public` value from `profile.products` // todo: pull `public` value from `profile.products`
res.id = pt.jny.jid res.tripId = pt.jny.jid
res.line = lines[parseInt(pt.jny.prodX)] || null res.line = lines[parseInt(pt.jny.prodX)] || null
res.direction = profile.parseStationName(pt.jny.dirTxt) || null res.direction = profile.parseStationName(pt.jny.dirTxt) || null