handle missing dirTxt 🐛

This commit is contained in:
Jannis R 2019-04-01 19:22:10 +02:00
parent ab00a9360f
commit 6aa57d4616
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
3 changed files with 3 additions and 3 deletions

View file

@ -21,7 +21,7 @@ const createParseArrOrDep = (profile, opt, data, prefix) => {
stop: locations[parseInt(d.stbStop.locX)] || null, stop: locations[parseInt(d.stbStop.locX)] || null,
when: profile.parseDateTime(profile, d.date, t, tz), when: profile.parseDateTime(profile, d.date, t, tz),
// todo: for arrivals, this is the *origin*, not the *direction* // todo: for arrivals, this is the *origin*, not the *direction*
direction: prefix === DEPARTURE && profile.parseStationName(d.dirTxt) || null, direction: prefix === DEPARTURE && d.dirTxt && profile.parseStationName(d.dirTxt) || null,
line: lines[parseInt(d.prodX)] || null, line: lines[parseInt(d.prodX)] || null,
remarks: [] remarks: []
} }

View file

@ -92,7 +92,7 @@ const createParseJourneyLeg = (profile, opt, data) => {
// todo: pull `public` value from `profile.products` // todo: pull `public` value from `profile.products`
res.tripId = 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 = pt.jny.dirTxt && profile.parseStationName(pt.jny.dirTxt) || null
if (pt.dep.dPlatfS) res.departurePlatform = pt.dep.dPlatfS if (pt.dep.dPlatfS) res.departurePlatform = pt.dep.dPlatfS
if (pt.arr.aPlatfS) res.arrivalPlatform = pt.arr.aPlatfS if (pt.arr.aPlatfS) res.arrivalPlatform = pt.arr.aPlatfS

View file

@ -13,7 +13,7 @@ const createParseMovement = (profile, opt, data) => {
const pStopover = profile.parseStopover(profile, opt, data, m.date) const pStopover = profile.parseStopover(profile, opt, data, m.date)
const res = { const res = {
direction: profile.parseStationName(m.dirTxt), direction: m.dirTxt ? profile.parseStationName(m.dirTxt) : null,
tripId: m.jid || null, tripId: m.jid || null,
line: lines[m.prodX] || null, line: lines[m.prodX] || null,
location: m.pos ? { location: m.pos ? {