mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
journey leg: delay -> departureDelay/arrivalDelay as in docs 🐛
This commit is contained in:
parent
a769291d95
commit
be6d063cf3
1 changed files with 8 additions and 4 deletions
|
@ -26,7 +26,12 @@ const createParseJourneyLeg = (profile, stations, lines, remarks) => {
|
||||||
if (pt.dep.dTimeR && pt.dep.dTimeS) {
|
if (pt.dep.dTimeR && pt.dep.dTimeS) {
|
||||||
const realtime = profile.parseDateTime(profile, j.date, pt.dep.dTimeR)
|
const realtime = profile.parseDateTime(profile, j.date, pt.dep.dTimeR)
|
||||||
const planned = profile.parseDateTime(profile, j.date, pt.dep.dTimeS)
|
const planned = profile.parseDateTime(profile, j.date, pt.dep.dTimeS)
|
||||||
res.delay = Math.round((realtime - planned) / 1000)
|
res.departureDelay = Math.round((realtime - planned) / 1000)
|
||||||
|
}
|
||||||
|
if (pt.arr.aTimeR && pt.arr.aTimeS) {
|
||||||
|
const realtime = profile.parseDateTime(profile, j.date, pt.arr.aTimeR)
|
||||||
|
const planned = profile.parseDateTime(profile, j.date, pt.arr.aTimeS)
|
||||||
|
res.arrivalDelay = Math.round((realtime - planned) / 1000)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pt.type === 'WALK') {
|
if (pt.type === 'WALK') {
|
||||||
|
@ -70,12 +75,11 @@ const createParseJourneyLeg = (profile, stations, lines, remarks) => {
|
||||||
// see also derhuerst/vbb-rest#19
|
// see also derhuerst/vbb-rest#19
|
||||||
if (pt.arr.aCncl) {
|
if (pt.arr.aCncl) {
|
||||||
res.cancelled = true
|
res.cancelled = true
|
||||||
res.arrival = res.arrivalPlatform = null
|
res.arrival = res.arrivalPlatform = res.arrivalDelay = null
|
||||||
}
|
}
|
||||||
if (pt.dep.dCncl) {
|
if (pt.dep.dCncl) {
|
||||||
res.cancelled = true
|
res.cancelled = true
|
||||||
res.departure = res.departurePlatform = null
|
res.departure = res.departurePlatform = res.departureDelay = null
|
||||||
res.delay = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
Loading…
Add table
Reference in a new issue