mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
leg.id -> leg.tripId 💥
This commit is contained in:
parent
2e12206c0b
commit
96ff59dc43
2 changed files with 6 additions and 3 deletions
7
index.js
7
index.js
|
@ -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
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue