mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
parseLine: prodCtx.lineId as id, nameS as name
This commit is contained in:
parent
044a5ee816
commit
b37bedba26
1 changed files with 8 additions and 8 deletions
|
@ -12,21 +12,21 @@ const createParseLine = (profile, opt, {operators}) => {
|
|||
|
||||
const parseLine = (p) => {
|
||||
if (!p) return null // todo: handle this upstream
|
||||
const name = p.line || p.nameS || p.name || null
|
||||
const res = {
|
||||
type: 'line',
|
||||
id: null,
|
||||
// This is terrible, but FPTF demands an ID. Let's pray for HAFAS.
|
||||
id: (
|
||||
p.prodCtx && p.prodCtx.lineId && slugg(p.prodCtx.lineId.trim())
|
||||
|| name && slugg(name.trim())
|
||||
|| null
|
||||
),
|
||||
fahrtNr: p.prodCtx && p.prodCtx.num || null,
|
||||
name: p.line || p.name,
|
||||
name,
|
||||
public: true
|
||||
}
|
||||
// todo: what is p.prodCtx && p.prodCtx.num?
|
||||
// todo: what is p.number?
|
||||
|
||||
// This is terrible, but FPTF demands an ID. Let's pray for HaCon to expose an ID.
|
||||
// todo: find a better way
|
||||
if (p.line) res.id = slugg(p.line.trim())
|
||||
else if (p.name) res.id = slugg(p.name.trim())
|
||||
|
||||
if (p.cls) res.class = p.cls
|
||||
if (p.prodCtx && p.prodCtx.catCode !== undefined) {
|
||||
res.productCode = +p.prodCtx.catCode
|
||||
|
|
Loading…
Add table
Reference in a new issue