mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
arrival.direction = null 🐛
For arrivals, `d.dirTxt` didn't contain the direction, but the origin.
This commit is contained in:
parent
ee7ad74fd3
commit
044a5ee816
1 changed files with 6 additions and 2 deletions
|
@ -2,12 +2,15 @@
|
|||
|
||||
const findRemark = require('./find-remark')
|
||||
|
||||
const ARRIVAL = 'a'
|
||||
const DEPARTURE = 'd'
|
||||
|
||||
// todo: what is d.jny.dirFlg?
|
||||
// todo: d.stbStop.dProgType/d.stbStop.aProgType
|
||||
|
||||
const createParseArrOrDep = (profile, opt, data, prefix) => {
|
||||
const {locations, lines, hints, warnings} = data
|
||||
if (prefix !== 'a' && prefix !== 'd') throw new Error('invalid prefix')
|
||||
if (prefix !== ARRIVAL && prefix !== DEPARTURE) throw new Error('invalid prefix')
|
||||
|
||||
const parseArrOrDep = (d) => {
|
||||
const t = d.stbStop[prefix + 'TimeR'] || d.stbStop[prefix + 'TimeS']
|
||||
|
@ -17,7 +20,8 @@ const createParseArrOrDep = (profile, opt, data, prefix) => {
|
|||
tripId: d.jid,
|
||||
stop: locations[parseInt(d.stbStop.locX)] || null,
|
||||
when: when.toISO(),
|
||||
direction: profile.parseStationName(d.dirTxt),
|
||||
// todo: for arrivals, this is the *origin*, not the *direction*
|
||||
direction: prefix === DEPARTURE && profile.parseStationName(d.dirTxt) || null,
|
||||
line: lines[parseInt(d.prodX)] || null,
|
||||
remarks: [],
|
||||
// todo: res.trip from rawLine.prodCtx.num?
|
||||
|
|
Loading…
Add table
Reference in a new issue