mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
parent
9f2dcecf19
commit
0a63698100
3 changed files with 2050 additions and 1 deletions
|
@ -90,7 +90,7 @@ const parseJourneyLeg = (ctx, pt, date) => { // pt = raw leg
|
||||||
res.polyline = profile.parsePolyline(ctx, pt.jny.poly)
|
res.polyline = profile.parsePolyline(ctx, pt.jny.poly)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pt.type === 'WALK' || pt.type === 'TRSF' || pt.type === 'DEVI') {
|
if (pt.type === 'WALK' || pt.type === 'TRSF' || pt.type === 'DEVI' || pt.type === 'CHKI') {
|
||||||
res.public = true
|
res.public = true
|
||||||
res.walking = true
|
res.walking = true
|
||||||
res.distance = pt.gis && pt.gis.dist || null
|
res.distance = pt.gis && pt.gis.dist || null
|
||||||
|
@ -99,6 +99,7 @@ const parseJourneyLeg = (ctx, pt, date) => { // pt = raw leg
|
||||||
// todo: pt.resState, pt.resRecommendation
|
// todo: pt.resState, pt.resRecommendation
|
||||||
res.transfer = true
|
res.transfer = true
|
||||||
}
|
}
|
||||||
|
if (pt.type === 'CHKI') res.checkin = true
|
||||||
|
|
||||||
// https://gist.github.com/derhuerst/426d4b95aeae701843b1e9c23105b8d4#file-tripsearch-2018-12-05-http-L4207-L4229
|
// https://gist.github.com/derhuerst/426d4b95aeae701843b1e9c23105b8d4#file-tripsearch-2018-12-05-http-L4207-L4229
|
||||||
if (opt.remarks && pt.gis && Array.isArray(pt.gis.msgL)) {
|
if (opt.remarks && pt.gis && Array.isArray(pt.gis.msgL)) {
|
||||||
|
|
2019
test/fixtures/sncb-journey-with-chki.json
vendored
Normal file
2019
test/fixtures/sncb-journey-with-chki.json
vendored
Normal file
File diff suppressed because it is too large
Load diff
29
test/sncb-journey-with-chki.js
Normal file
29
test/sncb-journey-with-chki.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
'use strict'
|
||||||
|
|
||||||
|
const tap = require('tap')
|
||||||
|
|
||||||
|
const createClient = require('..')
|
||||||
|
const rawProfile = require('../p/sncb')
|
||||||
|
const resWithChkiLeg = require('./fixtures/sncb-journey-with-chki.json')
|
||||||
|
|
||||||
|
const client = createClient(rawProfile, 'public-transport/hafas-client:test')
|
||||||
|
const {profile} = client
|
||||||
|
|
||||||
|
const opt = {
|
||||||
|
stopovers: false,
|
||||||
|
tickets: false,
|
||||||
|
polylines: false,
|
||||||
|
subStops: false,
|
||||||
|
entrances: false,
|
||||||
|
remarks: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
tap.test('parses a journey with a CHKI leg (#267)', (t) => {
|
||||||
|
const common = profile.parseCommon({profile, opt, res: resWithChkiLeg})
|
||||||
|
const ctx = {profile, opt, common, res: resWithChkiLeg}
|
||||||
|
const journey = profile.parseJourney(ctx, resWithChkiLeg.outConL[0])
|
||||||
|
|
||||||
|
const checkinLeg = journey.legs[0]
|
||||||
|
t.equal(checkinLeg.checkin, true, 'checkinLeg.checkin')
|
||||||
|
t.end()
|
||||||
|
})
|
Loading…
Add table
Reference in a new issue