From b37bedba265889161825f23534a56f4253ff8959 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Mon, 3 Sep 2018 15:13:23 +0200 Subject: [PATCH] parseLine: prodCtx.lineId as id, nameS as name --- parse/line.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/parse/line.js b/parse/line.js index c9d2710f..18975933 100644 --- a/parse/line.js +++ b/parse/line.js @@ -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