mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
mark journeys & journey parts as cancelled
see derhuerst/vbb-gtfs#19 see public-transport/friend-public-transport-format#27
This commit is contained in:
parent
817f44ea39
commit
658d67e3b2
2 changed files with 16 additions and 1 deletions
|
@ -78,6 +78,15 @@ 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
|
||||||
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,19 @@ const createParseJourney = (profile, stations, lines, remarks) => {
|
||||||
// todo: use computed information from part
|
// todo: use computed information from part
|
||||||
const parseJourney = (j) => {
|
const parseJourney = (j) => {
|
||||||
const parts = j.secL.map(part => parsePart(j, part))
|
const parts = j.secL.map(part => parsePart(j, part))
|
||||||
return {
|
const res = {
|
||||||
parts,
|
parts,
|
||||||
origin: parts[0].origin,
|
origin: parts[0].origin,
|
||||||
destination: parts[parts.length - 1].destination,
|
destination: parts[parts.length - 1].destination,
|
||||||
departure: parts[0].departure,
|
departure: parts[0].departure,
|
||||||
arrival: parts[parts.length - 1].arrival
|
arrival: parts[parts.length - 1].arrival
|
||||||
}
|
}
|
||||||
|
if (parts.some(p => p.cancelled)) {
|
||||||
|
res.cancelled = true
|
||||||
|
res.departure = res.arrival = null
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
return parseJourney
|
return parseJourney
|
||||||
|
|
Loading…
Add table
Reference in a new issue