mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
VBB: add (anti)clockwise symbols to Ringbahn
This commit is contained in:
parent
81c9411cfe
commit
040ed41de7
2 changed files with 25 additions and 1 deletions
|
@ -10,6 +10,7 @@ const _parseLine = require('../../parse/line')
|
||||||
const _parseLocation = require('../../parse/location')
|
const _parseLocation = require('../../parse/location')
|
||||||
const _createParseJourney = require('../../parse/journey')
|
const _createParseJourney = require('../../parse/journey')
|
||||||
const _createParseStopover = require('../../parse/stopover')
|
const _createParseStopover = require('../../parse/stopover')
|
||||||
|
const _createParseDeparture = require('../../parse/departure')
|
||||||
const _formatStation = require('../../format/station')
|
const _formatStation = require('../../format/station')
|
||||||
const createParseBitmask = require('../../parse/products-bitmask')
|
const createParseBitmask = require('../../parse/products-bitmask')
|
||||||
const createFormatBitmask = require('../../format/products-bitmask')
|
const createFormatBitmask = require('../../format/products-bitmask')
|
||||||
|
@ -107,6 +108,26 @@ const createParseStopover = (profile, stations, lines, remarks, connection) => {
|
||||||
return parseStopoverWithShorten
|
return parseStopoverWithShorten
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const createParseDeparture = (profile, stations, lines, remarks) => {
|
||||||
|
const parseDeparture = _createParseDeparture(profile, stations, lines, remarks)
|
||||||
|
|
||||||
|
const ringbahnClockwise = /^ringbahn s\s?41$/i
|
||||||
|
const ringbahnAnticlockwise = /^ringbahn s\s?42$/i
|
||||||
|
const parseDepartureRenameRingbahn = (j) => {
|
||||||
|
const res = parseDeparture(j)
|
||||||
|
|
||||||
|
if (res.line && res.line.product === 'suburban') {
|
||||||
|
const d = res.direction && res.direction.trim()
|
||||||
|
if (ringbahnClockwise.test(d)) res.direction = 'Ringbahn S41 ⟳'
|
||||||
|
else if (ringbahnAnticlockwise.test(d)) res.direction = 'Ringbahn S42 ⟲'
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
return parseDepartureRenameRingbahn
|
||||||
|
}
|
||||||
|
|
||||||
const isIBNR = /^\d{9,}$/
|
const isIBNR = /^\d{9,}$/
|
||||||
const formatStation = (id) => {
|
const formatStation = (id) => {
|
||||||
if (!isIBNR.test(id)) throw new Error('station ID must be an IBNR.')
|
if (!isIBNR.test(id)) throw new Error('station ID must be an IBNR.')
|
||||||
|
@ -145,6 +166,7 @@ const vbbProfile = {
|
||||||
parseLine,
|
parseLine,
|
||||||
parseProducts: createParseBitmask(modes.bitmasks),
|
parseProducts: createParseBitmask(modes.bitmasks),
|
||||||
parseJourney: createParseJourney,
|
parseJourney: createParseJourney,
|
||||||
|
parseDeparture: createParseDeparture,
|
||||||
parseStopover: createParseStopover,
|
parseStopover: createParseStopover,
|
||||||
|
|
||||||
formatStation,
|
formatStation,
|
||||||
|
|
|
@ -11,7 +11,9 @@ const parseLine = (profile, p) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.cls) res.class = p.cls
|
if (p.cls) res.class = p.cls
|
||||||
if (p.prodCtx) res.productCode = +p.prodCtx.catCode
|
if (p.prodCtx && p.prodCtx.catCode !== undefined) {
|
||||||
|
res.productCode = +p.prodCtx.catCode
|
||||||
|
}
|
||||||
|
|
||||||
// todo: parse mode, remove from profiles
|
// todo: parse mode, remove from profiles
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue