leg.passed -> leg.stopovers 💥

Some didn't unterstand what "passed" means in this context.
"stopovers" is a lot less ambiguous; Also, it aligns with
`parseStopover` and FPTF.
This commit is contained in:
Jannis R 2018-06-13 20:35:06 +02:00 committed by Jannis Redmann
parent 3e18f5d415
commit 6611f262bf
7 changed files with 15 additions and 15 deletions

View file

@ -114,7 +114,7 @@ The response looked like this:
} }
}, },
direction: 'S Spandau', direction: 'S Spandau',
passed: [ /* … */ ] stopovers: [ /* … */ ]
} }
``` ```

View file

@ -159,7 +159,7 @@ The response may look like this:
} }
}, },
direction: 'S Potsdam Hauptbahnhof', direction: 'S Potsdam Hauptbahnhof',
passed: [ { stopovers: [ {
station: { station: {
type: 'station', type: 'station',
id: '900000003201', id: '900000003201',

View file

@ -58,9 +58,9 @@ const createParseJourneyLeg = (profile, stations, lines, remarks, polylines) =>
if (passed && pt.jny.stopL) { if (passed && pt.jny.stopL) {
const parse = profile.parseStopover(profile, stations, lines, remarks, j.date) const parse = profile.parseStopover(profile, stations, lines, remarks, j.date)
const passedStations = pt.jny.stopL.map(parse) const stopovers = pt.jny.stopL.map(parse)
// filter stations the train passes without stopping, as this doesn't comply with fptf (yet) // filter stations the train passes without stopping, as this doesn't comply with fptf (yet)
res.passed = passedStations.filter((x) => !x.passBy) res.stopovers = stopovers.filter((x) => !x.passBy)
} }
if (Array.isArray(pt.jny.remL)) { if (Array.isArray(pt.jny.remL)) {
for (let remark of pt.jny.remL) applyRemark(j, remark) for (let remark of pt.jny.remL) applyRemark(j, remark)

View file

@ -11,8 +11,8 @@ const testJourneysWithDetour = co(function* (cfg) {
validate(t, journeys, 'journeys', 'journeys') validate(t, journeys, 'journeys', 'journeys')
const leg = journeys[0].legs.some((leg) => { const leg = journeys[0].legs.some((leg) => {
return leg.passed && leg.passed.some((passed) => { return leg.stopovers && leg.stopovers.some((stopover) => {
return detourIds.includes(passed.station.id) return detourIds.includes(stopover.station.id)
}) })
}) })
t.ok(leg, detourIds.join('/') + ' is not being passed') t.ok(leg, detourIds.join('/') + ' is not being passed')

View file

@ -171,12 +171,12 @@ const createValidateJourneyLeg = (cfg) => {
a.ok(leg.departurePlatform, name + '.departurePlatform must not be empty') a.ok(leg.departurePlatform, name + '.departurePlatform must not be empty')
} }
if ('passed' in leg) { if ('stopovers' in leg) {
a.ok(Array.isArray(leg.passed), name + '.passed must be an array') a.ok(Array.isArray(leg.stopovers), name + '.stopovers must be an array')
a.ok(leg.passed.length > 0, name + '.passed must not be empty') a.ok(leg.stopovers.length > 0, name + '.stopovers must not be empty')
for (let i = 0; i < leg.passed.length; i++) { for (let i = 0; i < leg.stopovers.length; i++) {
val.stopover(val, leg.passed[i], name + `.passed[${i}]`) val.stopover(val, leg.stopovers[i], name + `.stopovers[${i}]`)
} }
} }

View file

@ -159,8 +159,8 @@ test('Husum to Lübeck Hbf with stopover at Kiel Hbf', co(function* (t) {
validate(t, journeys, 'journeys', 'journeys') validate(t, journeys, 'journeys', 'journeys')
const leg = journeys[0].legs.some((leg) => { const leg = journeys[0].legs.some((leg) => {
return leg.passed && leg.passed.some((passed) => { return leg.stopovers && leg.stopovers.some((stopover) => {
return passed.station.id === kielHbf return stopover.station.id === kielHbf
}) })
}) })
t.ok(leg, 'Kiel Hbf is not being passed') t.ok(leg, 'Kiel Hbf is not being passed')

View file

@ -188,8 +188,8 @@ test('journeys: via works without detour', co(function* (t) {
t.notOk(l1, 'transfer at Museumsquartier') t.notOk(l1, 'transfer at Museumsquartier')
const l2 = journeys[0].legs.some((leg) => { const l2 = journeys[0].legs.some((leg) => {
return leg.passed && leg.passed.some((passed) => { return leg.stopovers && leg.stopovers.some((stopover) => {
return passed.station.id === museumsquartierPassed return stopover.station.id === museumsquartierPassed
}) })
}) })
t.ok(l2, 'Museumsquartier is not being passed') t.ok(l2, 'Museumsquartier is not being passed')