diff --git a/p/db/index.js b/p/db/index.js index 02210b9d..9217e7a2 100644 --- a/p/db/index.js +++ b/p/db/index.js @@ -73,6 +73,8 @@ const parseLine = (profile, l) => { const createParseJourney = (profile, stations, lines, remarks) => { const parseJourney = _createParseJourney(profile, stations, lines, remarks) + // todo: j.sotRating, j.conSubscr, j.isSotCon, j.showARSLink, k.sotCtxt + // todo: j.conSubscr, j.showARSLink, j.useableTime const parseJourneyWithPrice = (j) => { const res = parseJourney(j) diff --git a/p/vbb/index.js b/p/vbb/index.js index 9cb44899..9fe551b6 100644 --- a/p/vbb/index.js +++ b/p/vbb/index.js @@ -50,10 +50,8 @@ const parseLine = (profile, l) => { const parseLocation = (profile, l) => { const res = _parseLocation(profile, l) - // todo: shorten has been made for stations, not any type of location - res.name = shorten(res.name) - if (res.type === 'station') { + res.name = shorten(res.name) res.id = to12Digit(res.id) // todo: https://github.com/derhuerst/vbb-hafas/blob/1c64bfe42422e2648b21016d233c808460250308/lib/parse.js#L67-L75 } diff --git a/parse/date-time.js b/parse/date-time.js index 4ff6900d..78635354 100644 --- a/parse/date-time.js +++ b/parse/date-time.js @@ -17,7 +17,6 @@ const parseDateTime = (profile, date, time) => { const offset = time.length > 6 ? parseInt(time.slice(0, -6)) : 0 - console.error(pDate, pTime, offset) const dt = DateTime.fromISO(pDate.join('-') + 'T' + pTime.join(':'), { locale: profile.locale, zone: profile.timezone diff --git a/parse/location.js b/parse/location.js index 1b7be2f3..1c8d37b7 100644 --- a/parse/location.js +++ b/parse/location.js @@ -17,13 +17,14 @@ const parseLocation = (profile, l) => { const station = { type: 'station', id: l.extId, + name: l.name, location: res } if ('pCls' in l) station.products = profile.parseProducts(l.pCls) return station } - if (type === POI) res.id = l.extId + if (l.type === POI) res.id = l.extId else if (l.type === ADDRESS) res.address = l.name else res.name = l.name diff --git a/parse/movement.js b/parse/movement.js index f5b032ef..2fe3d132 100644 --- a/parse/movement.js +++ b/parse/movement.js @@ -19,8 +19,8 @@ const createParseMovement = (profile, locations, lines, remarks) => { return { station: locations[s.locX], - departure: dep ? dep.format() : null, - arrival: arr ? arr.format() : null + departure: dep ? dep.toISO() : null, + arrival: arr ? arr.toISO() : null } } diff --git a/parse/stopover.js b/parse/stopover.js index 3a0e05d8..d7a3d24f 100644 --- a/parse/stopover.js +++ b/parse/stopover.js @@ -7,11 +7,11 @@ const createParseStopover = (profile, stations, lines, remarks, connection) => { } if (st.aTimeR || st.aTimeS) { const arr = profile.parseDateTime(profile, connection.date, st.aTimeR || st.aTimeS) - res.arrival = arr.format() + res.arrival = arr.toISO() } if (st.dTimeR || st.dTimeS) { const dep = profile.parseDateTime(profile, connection.date, st.dTimeR || st.dTimeS) - res.departure = dep.format() + res.departure = dep.toISO() } return res } diff --git a/test/db.js b/test/db.js index b9634e45..a40a6ad3 100644 --- a/test/db.js +++ b/test/db.js @@ -67,6 +67,8 @@ const assertIsJungfernheide = (t, s) => { t.ok(isRoughlyEqual(s.location.longitude, 13.299424, .0005)) } +// todo: this doesnt seem to work +// todo: DRY with assertValidStationProducts const assertValidProducts = (t, p) => { for (let k of Object.keys(modes)) { t.ok('boolean', typeof modes[k], 'mode ' + k + ' must be a boolean') @@ -169,7 +171,7 @@ test('Berlin Jungfernheide to Torfstraße 17', co.wrap(function* (t) { const d = part.destination assertValidAddress(t, d) - t.equal(d.name, 'Torfstraße 17') + t.equal(d.address, 'Torfstraße 17') t.ok(isRoughlyEqual(.0001, d.latitude, 52.5416823)) t.ok(isRoughlyEqual(.0001, d.longitude, 13.3491223)) diff --git a/test/util.js b/test/util.js index 1d9b2047..d7b73170 100644 --- a/test/util.js +++ b/test/util.js @@ -55,6 +55,7 @@ const assertValidLocation = (t, l, coordsOptional = false) => { } } +// todo: https://github.com/public-transport/friendly-public-transport-format/tree/babf2b82947ab0e655a4a0e1cbee6b5519af9172/spec#modes const isValidMode = (m) => { return m === 'walking' || m === 'train' || diff --git a/test/vbb.js b/test/vbb.js index 2bbf1ac7..86369d34 100644 --- a/test/vbb.js +++ b/test/vbb.js @@ -203,7 +203,7 @@ test('journeys – station to address', co.wrap(function* (t) { const dest = part.destination assertValidAddress(t, dest) - t.strictEqual(dest.name, 'Torfstr. 17') + t.strictEqual(dest.address, 'Torfstraße 17') t.ok(isRoughlyEqual(.0001, dest.latitude, 52.5416823)) t.ok(isRoughlyEqual(.0001, dest.longitude, 13.3491223)) assertValidWhen(t, part.arrival)