mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
fix cancelled journey legs 🐛, cancelled departures & passed stations, 1.3.1
This commit is contained in:
parent
4ee1b27ae6
commit
abf323d27c
2 changed files with 13 additions and 3 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "hafas-client",
|
||||
"description": "JavaScript client for HAFAS mobile APIs.",
|
||||
"version": "1.3.0",
|
||||
"version": "1.3.1",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
"index.js",
|
||||
|
|
14
parse.js
14
parse.js
|
@ -73,6 +73,9 @@ const stopover = (tz, s, ln, r, c) => (st) => {
|
|||
if (st.dTimeR || st.dTimeS) {
|
||||
result.departure = dateTime(tz, c.date, st.dTimeR || st.dTimeS).format()
|
||||
}
|
||||
if (st.aCncl && st.dCncl) {
|
||||
result.cancelled = true
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
|
@ -121,7 +124,9 @@ const part = (tz, s, ln, r, c) => (pt) => {
|
|||
}
|
||||
|
||||
// todo: follow public-transport/friendly-public-transport-format#27 here
|
||||
if (pt.dep.dCncl && pt.arr.dCncl) result.cancelled = true
|
||||
if (pt.dep.dCncl && pt.arr.aCncl) {
|
||||
result.cancelled = true
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
@ -144,7 +149,6 @@ const journey = (tz, s, ln, r, p = part) => (c) => {
|
|||
}
|
||||
|
||||
// todos from derhuerst/hafas-client#2
|
||||
// - stdStop.dCncl
|
||||
// - stdStop.dPlatfS, stdStop.dPlatfR
|
||||
// todo: what is d.jny.dirFlg?
|
||||
// todo: d.stbStop.dProgType
|
||||
|
@ -164,6 +168,12 @@ const departure = (tz, s, ln, r) => (d) => {
|
|||
const planned = dateTime(tz, d.date, d.stbStop.dTimeS)
|
||||
result.delay = Math.round((realtime - planned) / 1000)
|
||||
} else result.delay = null
|
||||
|
||||
// todo: follow public-transport/friendly-public-transport-format#27 here
|
||||
if (d.stbStop.dCncl) {
|
||||
result.cancelled = true
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue