mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
WIP parse remarks
This commit is contained in:
parent
856a751b51
commit
0775a27d1d
1 changed files with 84 additions and 1 deletions
|
@ -1,8 +1,91 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
const hints = Object.assign(Object.create(null), {
|
||||||
|
fb: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'bicycle-con',
|
||||||
|
text: 'bicycles conveyed'
|
||||||
|
},
|
||||||
|
k2: {
|
||||||
|
type: 'hint',
|
||||||
|
code: '2nd-class-only',
|
||||||
|
text: '2. class only'
|
||||||
|
},
|
||||||
|
eh: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'boarding-ramp',
|
||||||
|
text: 'vehicle-mounted boarding ramp available'
|
||||||
|
},
|
||||||
|
wv: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'wifi',
|
||||||
|
text: 'WiFi available'
|
||||||
|
},
|
||||||
|
sn: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'snacks',
|
||||||
|
text: 'snacks available for purchase'
|
||||||
|
},
|
||||||
|
bf: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'barrier-free',
|
||||||
|
text: 'barrier-free'
|
||||||
|
},
|
||||||
|
bt: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'on-board-bistro',
|
||||||
|
text: 'Bordbistro available'
|
||||||
|
},
|
||||||
|
br: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'on-board-restaurant',
|
||||||
|
text: 'Bordrestaurant available'
|
||||||
|
},
|
||||||
|
ki: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'childrens-area',
|
||||||
|
text: `children's area available`
|
||||||
|
},
|
||||||
|
ls: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'power-sockets',
|
||||||
|
text: 'power sockets available'
|
||||||
|
},
|
||||||
|
ev: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'replacement-service',
|
||||||
|
text: 'replacement service'
|
||||||
|
},
|
||||||
|
kl: {
|
||||||
|
type: 'hint',
|
||||||
|
code: 'air-conditioned',
|
||||||
|
text: 'air-conditioned vehicle'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// todo: is passing in profile necessary?
|
// todo: is passing in profile necessary?
|
||||||
const parseRemark = (profile, r) => {
|
const parseRemark = (profile, r) => {
|
||||||
return null // todo
|
// todo: U "stop cancelled"?
|
||||||
|
// todo: P "journey cancelled", `r.sIdx`?
|
||||||
|
// todo: C
|
||||||
|
if (t.type === 'L') {
|
||||||
|
return {
|
||||||
|
type: 'status',
|
||||||
|
code: 'alternative-trip',
|
||||||
|
text: r.txtN,
|
||||||
|
journeyId: r.jid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (t.type === 'A') return hints[r.code && r.code.trim()] || null
|
||||||
|
if (t.type === 'R') {
|
||||||
|
// todo: how can we identify the individual types?
|
||||||
|
return {
|
||||||
|
type: 'status',
|
||||||
|
code: r.code,
|
||||||
|
text: r.txtN || ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = parseRemark
|
module.exports = parseRemark
|
||||||
|
|
Loading…
Add table
Reference in a new issue