fix cancelled state for exceptional cases

This commit is contained in:
Traines 2026-01-10 13:48:33 +00:00
parent 0c39991e0c
commit 6fa0abbde5
4 changed files with 33 additions and 33 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "db-vendo-client",
"version": "6.10.7",
"version": "6.10.8",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "db-vendo-client",
"version": "6.10.7",
"version": "6.10.8",
"license": "ISC",
"dependencies": {
"content-type": "^1.0.5",

View file

@ -1,7 +1,7 @@
{
"name": "db-vendo-client",
"description": "Client for bahn.de public transport APIs.",
"version": "6.10.7",
"version": "6.10.8",
"type": "module",
"main": "index.js",
"files": [

View file

@ -60,28 +60,28 @@ const parseRemarks = (ctx, ref) => {
};
/*
meldungenAsObject
meldungenAsObject
{
"code": "MDA-AK-MSG-1000",
"nachrichtKurz": "Connection is in the past.",
"nachrichtLang": "Selected connection is in the past.",
"fahrtRichtungKennzeichen": "HINFAHRT"
}
[
[
{
"code": "MDA-AK-MSG-3000",
"nachrichtKurz": "Booking not possible.",
"nachrichtLang": "Booking is no longer possible for the connection you selected",
"fahrtRichtungKennzeichen": "HINFAHRT"
}
]
]
priorisierteMeldungen
priorisierteMeldungen
{
"prioritaet": "HOCH",
"text": "ICE 597 departs differently from Mainz Hbf from Platform 1b"
}
[
[
{
"prioritaet": "NIEDRIG",
"text": "Advance notice! In the period from 15.12.24 to 17.01.25, construction work will take place between Mainz Hbf and Frankfurt(Main)Hbf. There will be changed run times and partial cancellation. Please inform yourself early on the Internet and at the stations."
@ -90,14 +90,14 @@ const parseRemarks = (ctx, ref) => {
"prioritaet": "HOCH",
"text": "The route between Mainz Hbf and Mainz Nord is currently closed. The reason is a repair on the track. At the moment, no train journeys are possible in the affected section of the route. As a result, there are now delays and partial failures. The trains terminates and starts unscheduled in Mainz Hbf. Please check your travel connections shortly before the train departs. This message will be updated as soon as we have more information."
}
]
[
]
[
{
"prioritaet": "HOCH",
"text": "Trip is not possible"
}
]
[
]
[
{
"prioritaet": "HOCH",
"text": "Intervention by authorities"
@ -106,44 +106,44 @@ const parseRemarks = (ctx, ref) => {
"prioritaet": "HOCH",
"text": "Switch repairs between Frankfurt(Main)Hbf and Mannheim Hbf delays rail transport. The train is diverted. The stop Mainz Hbf is cancelled. Please allow for a delay of up to 10 minutes. Please check for any changes to your journey prior to departure."
}
]
[
]
[
{
"prioritaet": "HOCH",
"text": "Stop cancelled",
"type": "HALT_AUSFALL"
}
]
]
risNotizen
{
"key": "text.realtime.connection.platform.change",
"value": "ICE 597 departs differently from Mainz Hbf from Platform 1b"
}
{key: "FT", value: "Staff delayed due to earlier journey", routeIdxFrom: 0, routeIdxTo: 12}
[
risNotizen
{
"key": "text.realtime.connection.platform.change",
"value": "ICE 597 departs differently from Mainz Hbf from Platform 1b"
}
{key: "FT", value: "Staff delayed due to earlier journey", routeIdxFrom: 0, routeIdxTo: 12}
[
{
"key": "text.realtime.connection.cancelled",
"value": "Trip is not possible"
}
]
[
]
[
{
"key": "FT",
"value": "Intervention by authorities",
"routeIdxFrom": 9,
"routeIdxTo": 21
}
]
[
]
[
{
"key": "text.realtime.stop.cancelled",
"value": "Stop cancelled"
}
]
]
himMeldungen
[
himMeldungen
[
{
"ueberschrift": "Construction work.",
"text": "Advance notice! In the period from 15.12.24 to 17.01.25, construction work will take place between Mainz Hbf and Frankfurt(Main)Hbf. There will be changed run times and partial cancellation. Please inform yourself early on the Internet and at the stations.",
@ -156,14 +156,14 @@ const parseRemarks = (ctx, ref) => {
"prioritaet": "HOCH",
"modDateTime": "2024-12-06T06:24:35"
}
[
[
{
"ueberschrift": "Disruption.",
"text": "Switch repairs between Frankfurt(Main)Hbf and Mannheim Hbf delays rail transport. The train is diverted. The stop Mainz Hbf is cancelled. Please allow for a delay of up to 10 minutes. Please check for any changes to your journey prior to departure.",
"prioritaet": "HOCH",
"modDateTime": "2024-12-05T19:01:48"
}
]
]
zugattribute
[
@ -213,7 +213,7 @@ const parseCancelled = (ref) => {
(ref.risNotizen || ref.echtzeitNotizen || ref.meldungen).find(r => r.key == 'text.realtime.stop.cancelled'
|| r.type == 'HALT_AUSFALL'
|| r.text == 'Halt entfällt'
|| r.text == 'Stop cancelled',
|| r.text?.includes('fällt aus') || r.text?.includes('cancelled'),
),
);
};

View file

@ -6,7 +6,7 @@ const parseTrip = (ctx, t, id) => { // t = raw trip
trip.id = trip.tripId || id;
delete trip.tripId;
delete trip.reachable;
trip.cancelled = Boolean(profile.parseCancelled(t));
trip.cancelled = Boolean(profile.parseCancelled(t) || trip.stopovers?.length && trip.stopovers?.every(s => s.cancelled));
// TODO opt.scheduledDays
return trip;