From c1bdade49fe192a990e0d40484ffebf4a5ab6138 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Sat, 30 Jun 2018 14:30:17 +0200 Subject: [PATCH] departures: parse & expose platform --- docs/departures.md | 4 +++- parse/departure.js | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/departures.md b/docs/departures.md index 1a16535a..255478c3 100644 --- a/docs/departures.md +++ b/docs/departures.md @@ -75,7 +75,8 @@ The response may look like this: } }, when: '2017-12-17T19:32:00.000+01:00', - delay: null + delay: null, + platform: '2', line: { type: 'line', id: '18299', @@ -143,6 +144,7 @@ The response may look like this: }, when: '2017-12-17T19:35:00.000+01:00', delay: 0, + platform: null, line: { type: 'line', id: '19494', diff --git a/parse/departure.js b/parse/departure.js index 1a496bc7..89224e12 100644 --- a/parse/departure.js +++ b/parse/departure.js @@ -1,7 +1,5 @@ 'use strict' -// todos from public-transport/hafas-client#2 -// - stdStop.dPlatfS, stdStop.dPlatfR // todo: what is d.jny.dirFlg? // todo: d.stbStop.dProgType // 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) } 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 parseJourneyLeg if (d.stbStop.aCncl || d.stbStop.dCncl) {