Skip to content

Commit 6fa0abb

Browse files
fix cancelled state for exceptional cases
1 parent 0c39991 commit 6fa0abb

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "db-vendo-client",
33
"description": "Client for bahn.de public transport APIs.",
4-
"version": "6.10.7",
4+
"version": "6.10.8",
55
"type": "module",
66
"main": "index.js",
77
"files": [

parse/remarks.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,28 @@ const parseRemarks = (ctx, ref) => {
6060
};
6161

6262
/*
63-
meldungenAsObject
63+
meldungenAsObject
6464
{
6565
"code": "MDA-AK-MSG-1000",
6666
"nachrichtKurz": "Connection is in the past.",
6767
"nachrichtLang": "Selected connection is in the past.",
6868
"fahrtRichtungKennzeichen": "HINFAHRT"
6969
}
70-
[
70+
[
7171
{
7272
"code": "MDA-AK-MSG-3000",
7373
"nachrichtKurz": "Booking not possible.",
7474
"nachrichtLang": "Booking is no longer possible for the connection you selected",
7575
"fahrtRichtungKennzeichen": "HINFAHRT"
7676
}
77-
]
77+
]
7878
79-
priorisierteMeldungen
79+
priorisierteMeldungen
8080
{
8181
"prioritaet": "HOCH",
8282
"text": "ICE 597 departs differently from Mainz Hbf from Platform 1b"
8383
}
84-
[
84+
[
8585
{
8686
"prioritaet": "NIEDRIG",
8787
"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) => {
9090
"prioritaet": "HOCH",
9191
"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."
9292
}
93-
]
94-
[
93+
]
94+
[
9595
{
9696
"prioritaet": "HOCH",
9797
"text": "Trip is not possible"
9898
}
99-
]
100-
[
99+
]
100+
[
101101
{
102102
"prioritaet": "HOCH",
103103
"text": "Intervention by authorities"
@@ -106,44 +106,44 @@ const parseRemarks = (ctx, ref) => {
106106
"prioritaet": "HOCH",
107107
"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."
108108
}
109-
]
110-
[
109+
]
110+
[
111111
{
112112
"prioritaet": "HOCH",
113113
"text": "Stop cancelled",
114114
"type": "HALT_AUSFALL"
115115
}
116-
]
116+
]
117117
118-
risNotizen
119-
{
120-
"key": "text.realtime.connection.platform.change",
121-
"value": "ICE 597 departs differently from Mainz Hbf from Platform 1b"
122-
}
123-
{key: "FT", value: "Staff delayed due to earlier journey", routeIdxFrom: 0, routeIdxTo: 12}
124-
[
118+
risNotizen
119+
{
120+
"key": "text.realtime.connection.platform.change",
121+
"value": "ICE 597 departs differently from Mainz Hbf from Platform 1b"
122+
}
123+
{key: "FT", value: "Staff delayed due to earlier journey", routeIdxFrom: 0, routeIdxTo: 12}
124+
[
125125
{
126126
"key": "text.realtime.connection.cancelled",
127127
"value": "Trip is not possible"
128128
}
129-
]
130-
[
129+
]
130+
[
131131
{
132132
"key": "FT",
133133
"value": "Intervention by authorities",
134134
"routeIdxFrom": 9,
135135
"routeIdxTo": 21
136136
}
137-
]
138-
[
137+
]
138+
[
139139
{
140140
"key": "text.realtime.stop.cancelled",
141141
"value": "Stop cancelled"
142142
}
143-
]
143+
]
144144
145-
himMeldungen
146-
[
145+
himMeldungen
146+
[
147147
{
148148
"ueberschrift": "Construction work.",
149149
"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) => {
156156
"prioritaet": "HOCH",
157157
"modDateTime": "2024-12-06T06:24:35"
158158
}
159-
[
159+
[
160160
{
161161
"ueberschrift": "Disruption.",
162162
"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.",
163163
"prioritaet": "HOCH",
164164
"modDateTime": "2024-12-05T19:01:48"
165165
}
166-
]
166+
]
167167
168168
zugattribute
169169
[
@@ -213,7 +213,7 @@ const parseCancelled = (ref) => {
213213
(ref.risNotizen || ref.echtzeitNotizen || ref.meldungen).find(r => r.key == 'text.realtime.stop.cancelled'
214214
|| r.type == 'HALT_AUSFALL'
215215
|| r.text == 'Halt entfällt'
216-
|| r.text == 'Stop cancelled',
216+
|| r.text?.includes('fällt aus') || r.text?.includes('cancelled'),
217217
),
218218
);
219219
};

parse/trip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const parseTrip = (ctx, t, id) => { // t = raw trip
66
trip.id = trip.tripId || id;
77
delete trip.tripId;
88
delete trip.reachable;
9-
trip.cancelled = Boolean(profile.parseCancelled(t));
9+
trip.cancelled = Boolean(profile.parseCancelled(t) || trip.stopovers?.length && trip.stopovers?.every(s => s.cancelled));
1010

1111
// TODO opt.scheduledDays
1212
return trip;

0 commit comments

Comments
 (0)