mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 07:09:35 +02:00
cancelled flag for departures & passed stations
ported abf323d
over from master
This commit is contained in:
parent
965d5393ef
commit
f6077d5b6d
6 changed files with 38 additions and 11 deletions
|
@ -95,8 +95,9 @@ The response may look like this:
|
|||
journeyId: '1|30977|8|86|17122017',
|
||||
trip: 30977,
|
||||
station: { /* … */ },
|
||||
when: '2017-12-17T19:35:00.000+01:00',
|
||||
delay: 0,
|
||||
when: null,
|
||||
delay: null,
|
||||
cancelled: true,
|
||||
line: {
|
||||
type: 'line',
|
||||
id: '16441',
|
||||
|
|
|
@ -92,6 +92,7 @@ The response looked like this:
|
|||
}
|
||||
},
|
||||
arrival: '2017-12-17T19:49:00.000+01:00',
|
||||
arrivalPlatform: '2',
|
||||
line: {
|
||||
type: 'line',
|
||||
id: '18299',
|
||||
|
@ -106,7 +107,6 @@ The response looked like this:
|
|||
night: false,
|
||||
productCode: 0
|
||||
},
|
||||
arrivalPlatform: '2',
|
||||
direction: 'S Spandau',
|
||||
passed: [ /* … */ ]
|
||||
}
|
||||
|
|
|
@ -154,8 +154,9 @@ The response may look like this:
|
|||
location: { /* … */ },
|
||||
products: { /* … */ }
|
||||
},
|
||||
arrival: '2017-12-17T19:06:00.000+01:00',
|
||||
departure: '2017-12-17T19:07:00.000+01:00'
|
||||
arrival: null,
|
||||
departure: null,
|
||||
cancelled: true
|
||||
}, {
|
||||
station: {
|
||||
type: 'station',
|
||||
|
@ -234,3 +235,5 @@ If you pass `tickets: true`, each `journey` will have a tickets array that looks
|
|||
amount: 4
|
||||
} ]
|
||||
```
|
||||
|
||||
If a journey leg has been cancelled, a `cancelled: true` will be added. Also, `departure`/`departureDelay`/`departurePlatform` and `arrival`/`arrivalDelay`/`arrivalPlatform` will be `null`.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
// todos from derhuerst/hafas-client#2
|
||||
// - stdStop.dCncl
|
||||
// - stdStop.dPlatfS, stdStop.dPlatfR
|
||||
// todo: what is d.jny.dirFlg?
|
||||
// todo: d.stbStop.dProgType
|
||||
|
@ -29,6 +28,13 @@ const createParseDeparture = (profile, stations, lines, remarks) => {
|
|||
res.delay = Math.round((realtime - planned) / 1000)
|
||||
} else res.delay = null
|
||||
|
||||
// todo: follow public-transport/friendly-public-transport-format#27 here
|
||||
// see also derhuerst/vbb-rest#19
|
||||
if (pt.arr.aCncl || pt.dep.dCncl) {
|
||||
res.cancelled = true
|
||||
res.when = res.delay = null
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
|
|
|
@ -66,11 +66,14 @@ const createParseJourneyPart = (profile, stations, lines, remarks) => {
|
|||
|
||||
// todo: follow public-transport/friendly-public-transport-format#27 here
|
||||
// see also derhuerst/vbb-rest#19
|
||||
if (pt.arr.dCncl && pt.dep.dCncl) {
|
||||
result.cancelled = true
|
||||
result.departure = result.departurePlatform = null
|
||||
result.arrival = result.arrivalPlatform = null
|
||||
result.delay = null
|
||||
if (pt.arr.aCncl) {
|
||||
res.cancelled = true
|
||||
res.arrival = res.arrivalPlatform = null
|
||||
}
|
||||
if (pt.dep.dCncl) {
|
||||
res.cancelled = true
|
||||
res.departure = res.departurePlatform = null
|
||||
res.delay = null
|
||||
}
|
||||
|
||||
return res
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
// todo: arrivalDelay, departureDelay or only delay ?
|
||||
// todo: arrivalPlatform, departurePlatform
|
||||
const createParseStopover = (profile, stations, lines, remarks, connection) => {
|
||||
const parseStopover = (st) => {
|
||||
const res = {
|
||||
|
@ -13,6 +15,18 @@ const createParseStopover = (profile, stations, lines, remarks, connection) => {
|
|||
const dep = profile.parseDateTime(profile, connection.date, st.dTimeR || st.dTimeS)
|
||||
res.departure = dep.toISO()
|
||||
}
|
||||
|
||||
// todo: follow public-transport/friendly-public-transport-format#27 here
|
||||
// see also derhuerst/vbb-rest#19
|
||||
if (st.aCncl) {
|
||||
res.cancelled = true
|
||||
res.arrival = null
|
||||
}
|
||||
if (st.dCncl) {
|
||||
res.cancelled = true
|
||||
res.departure = null
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue