departures: parse & expose platform

This commit is contained in:
Jannis R 2018-06-30 14:30:17 +02:00
parent 4da8689ace
commit c1bdade49f
No known key found for this signature in database
GPG key ID: 0FE83946296A88A5
2 changed files with 8 additions and 3 deletions

View file

@ -75,7 +75,8 @@ The response may look like this:
} }
}, },
when: '2017-12-17T19:32:00.000+01:00', when: '2017-12-17T19:32:00.000+01:00',
delay: null delay: null,
platform: '2',
line: { line: {
type: 'line', type: 'line',
id: '18299', id: '18299',
@ -143,6 +144,7 @@ The response may look like this:
}, },
when: '2017-12-17T19:35:00.000+01:00', when: '2017-12-17T19:35:00.000+01:00',
delay: 0, delay: 0,
platform: null,
line: { line: {
type: 'line', type: 'line',
id: '19494', id: '19494',

View file

@ -1,7 +1,5 @@
'use strict' 'use strict'
// todos from public-transport/hafas-client#2
// - stdStop.dPlatfS, stdStop.dPlatfR
// todo: what is d.jny.dirFlg? // todo: what is d.jny.dirFlg?
// todo: d.stbStop.dProgType // todo: d.stbStop.dProgType
// todo: d.freq, d.freq.jnyL, see https://github.com/public-transport/hafas-client/blob/9203ed1481f08baacca41ac5e3c19bf022f01b0b/parse.js#L115 // todo: d.freq, d.freq.jnyL, see https://github.com/public-transport/hafas-client/blob/9203ed1481f08baacca41ac5e3c19bf022f01b0b/parse.js#L115
@ -30,6 +28,11 @@ const createParseDeparture = (profile, stations, lines, remarks) => {
res.delay = Math.round((realtime - planned) / 1000) res.delay = Math.round((realtime - planned) / 1000)
} else res.delay = null } else res.delay = null
// todo: DRY with parseStopover
// todo: DRY with parseJourneyLeg
res.platform = d.stbStop.dPlatfR || d.stbStop.dPlatfS || null
// todo: `formerScheduledPlatform`
// todo: DRY with parseStopover // todo: DRY with parseStopover
// todo: DRY with parseJourneyLeg // todo: DRY with parseJourneyLeg
if (d.stbStop.aCncl || d.stbStop.dCncl) { if (d.stbStop.aCncl || d.stbStop.dCncl) {