From ac56493768ce8de4ae0b689ab89a7c8dbc7cbaca Mon Sep 17 00:00:00 2001 From: Julius Tens Date: Fri, 29 Dec 2017 09:00:18 +0100 Subject: [PATCH] mark & filter stations that are passed without stopping, as they contain no arrival/departure time information which would violate the fptf spec --- parse/journey-leg.js | 4 +++- parse/stopover.js | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/parse/journey-leg.js b/parse/journey-leg.js index cf8a4f7a..56630d15 100644 --- a/parse/journey-leg.js +++ b/parse/journey-leg.js @@ -43,7 +43,9 @@ const createParseJourneyLeg = (profile, stations, lines, remarks) => { if (passed && pt.jny.stopL) { const parse = profile.parseStopover(profile, stations, lines, remarks, j) - res.passed = pt.jny.stopL.map(parse) + const passedStations = pt.jny.stopL.map(parse) + // filter stations the train passes without stopping, as this doesn't comply with fptf (yet) + res.passed = passedStations.filter((x) => !x.passBy) } if (Array.isArray(pt.jny.remL)) { for (let remark of pt.jny.remL) applyRemark(j, remark) diff --git a/parse/stopover.js b/parse/stopover.js index 216d9c1b..e17e1be3 100644 --- a/parse/stopover.js +++ b/parse/stopover.js @@ -16,6 +16,9 @@ const createParseStopover = (profile, stations, lines, remarks, connection) => { res.departure = dep.toISO() } + // mark stations the train passes without stopping + if(st.dInS === false && st.aOutS === false) res.passBy = true + // todo: follow public-transport/friendly-public-transport-format#27 here // see also derhuerst/vbb-rest#19 if (st.aCncl) {