mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
parse departure & arrival platforms, 0.7.0
This commit is contained in:
parent
92515200d0
commit
563c90c59c
1 changed files with 8 additions and 4 deletions
12
parse.js
12
parse.js
|
@ -77,10 +77,10 @@ const applyRemark = (s, p, r, c) => (rm) => null
|
||||||
// s = stations, p = products, r = remarks, c = connection
|
// s = stations, p = products, r = remarks, c = connection
|
||||||
const part = (tz, s, p, r, c) => (pt) => {
|
const part = (tz, s, p, r, c) => (pt) => {
|
||||||
const result = {
|
const result = {
|
||||||
from: s[parseInt(pt.dep.locX)]
|
from: Object.assign({}, s[parseInt(pt.dep.locX)])
|
||||||
, to: s[parseInt(pt.arr.locX)]
|
, to: Object.assign({}, s[parseInt(pt.arr.locX)])
|
||||||
, start: new Date(dateTime(tz, c.date, pt.dep.dTimeR || pt.dep.dTimeS))
|
, start: new Date(dateTime(tz, c.date, pt.dep.dTimeR || pt.dep.dTimeS))
|
||||||
, end: new Date(dateTime(tz, c.date, pt.arr.aTimeR || pt.arr.aTimeS))
|
, end: new Date(dateTime(tz, c.date, pt.arr.aTimeR || pt.arr.aTimeS))
|
||||||
}
|
}
|
||||||
if (pt.dep.dTimeR && pt.dep.dTimeS) result.delay =
|
if (pt.dep.dTimeR && pt.dep.dTimeS) result.delay =
|
||||||
dateTime(tz, c.date, pt.dep.dTimeR) - dateTime(tz, c.date, pt.dep.dTimeS)
|
dateTime(tz, c.date, pt.dep.dTimeR) - dateTime(tz, c.date, pt.dep.dTimeS)
|
||||||
|
@ -88,6 +88,10 @@ const part = (tz, s, p, r, c) => (pt) => {
|
||||||
else if (pt.type === 'JNY') {
|
else if (pt.type === 'JNY') {
|
||||||
result.product = p[parseInt(pt.jny.prodX)]
|
result.product = p[parseInt(pt.jny.prodX)]
|
||||||
result.direction = pt.jny.dirTxt // todo: parse this
|
result.direction = pt.jny.dirTxt // todo: parse this
|
||||||
|
|
||||||
|
if (pt.dep.dPlatfS) result.from.platform = pt.dep.dPlatfS
|
||||||
|
if (pt.arr.aPlatfS) result.to.platform = pt.arr.aPlatfS
|
||||||
|
|
||||||
if (pt.jny.stopL) result.passed = pt.jny.stopL.map(stop(tz, s, p, r, c))
|
if (pt.jny.stopL) result.passed = pt.jny.stopL.map(stop(tz, s, p, r, c))
|
||||||
if (Array.isArray(pt.jny.remL))
|
if (Array.isArray(pt.jny.remL))
|
||||||
pt.jny.remL.forEach(applyRemark(s, p, r, c))
|
pt.jny.remL.forEach(applyRemark(s, p, r, c))
|
||||||
|
|
Loading…
Add table
Reference in a new issue