mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19: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 findRemark = require('./find-remark')
|
||||||
|
|
||||||
|
const ARRIVAL = 'a'
|
||||||
|
const DEPARTURE = 'd'
|
||||||
|
|
||||||
// todo: what is d.jny.dirFlg?
|
// todo: what is d.jny.dirFlg?
|
||||||
// todo: d.stbStop.dProgType/d.stbStop.aProgType
|
// todo: d.stbStop.dProgType/d.stbStop.aProgType
|
||||||
|
|
||||||
const createParseArrOrDep = (profile, opt, data, prefix) => {
|
const createParseArrOrDep = (profile, opt, data, prefix) => {
|
||||||
const {locations, lines, hints, warnings} = data
|
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 parseArrOrDep = (d) => {
|
||||||
const t = d.stbStop[prefix + 'TimeR'] || d.stbStop[prefix + 'TimeS']
|
const t = d.stbStop[prefix + 'TimeR'] || d.stbStop[prefix + 'TimeS']
|
||||||
|
@ -17,7 +20,8 @@ const createParseArrOrDep = (profile, opt, data, prefix) => {
|
||||||
tripId: d.jid,
|
tripId: d.jid,
|
||||||
stop: locations[parseInt(d.stbStop.locX)] || null,
|
stop: locations[parseInt(d.stbStop.locX)] || null,
|
||||||
when: when.toISO(),
|
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,
|
line: lines[parseInt(d.prodX)] || null,
|
||||||
remarks: [],
|
remarks: [],
|
||||||
// todo: res.trip from rawLine.prodCtx.num?
|
// todo: res.trip from rawLine.prodCtx.num?
|
||||||
|
|
Loading…
Add table
Reference in a new issue