@@ -119,7 +119,7 @@ private function getStationFromHalt(array $rawHalt) {
119
119
//urgh, there is no lat/lon - extract it from id
120
120
// example id: A=1@O=Druseltal, Kassel@X=9414484@Y=51301106@U=81@L=714800@
121
121
$ matches = [];
122
- preg_match ('/@X=(\d+)@Y=(\d+)/ ' , $ rawHalt ['id ' ], $ matches );
122
+ preg_match ('/@X=(-? \d+)@Y=(-? \d+)/ ' , $ rawHalt ['id ' ], $ matches );
123
123
$ latitude = $ matches [2 ] / 1000000 ;
124
124
$ longitude = $ matches [1 ] / 1000000 ;
125
125
@@ -205,18 +205,22 @@ public function getDepartures(
205
205
$ departureStation = $ station ;
206
206
}
207
207
208
- // Cache data used for trip creation since another endpoints do not provide them
209
- Cache::add ($ journeyId , [
210
- 'category ' => $ hafasTravelType ,
211
- 'lineName ' => $ tripLineName
212
- ], now ()->addMinutes (30 ));
213
-
214
208
preg_match ('/#ZE#(\d+)/ ' , $ journeyId , $ matches );
215
209
$ journeyNumber = 0 ;
216
210
if (count ($ matches ) > 1 ) {
217
211
$ journeyNumber = $ matches [1 ];
212
+
213
+ if (empty ($ tripLineName )) {
214
+ $ tripLineName = $ matches [1 ];
215
+ }
218
216
}
219
217
218
+ // Cache data used for trip creation since another endpoints do not provide them
219
+ Cache::add ($ journeyId , [
220
+ 'category ' => $ hafasTravelType ,
221
+ 'lineName ' => $ tripLineName
222
+ ], now ()->addMinutes (30 ));
223
+
220
224
$ departure = new Departure (
221
225
station: $ departureStation ,
222
226
plannedDeparture: Carbon::parse ($ rawDeparture ['zeit ' ], $ timezone ),
0 commit comments