From fd4b752e6912147b9e2baba5dc252cc04ce9452c Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 1 Dec 2025 20:34:44 +0100 Subject: Journey: more train type edge cases (IC/ICE do not have kategorie, it seems) --- lib/Travel/Status/DE/DBRIS/Journey.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Travel/Status/DE/DBRIS/Journey.pm b/lib/Travel/Status/DE/DBRIS/Journey.pm index f85c3c3..7b135e0 100644 --- a/lib/Travel/Status/DE/DBRIS/Journey.pm +++ b/lib/Travel/Status/DE/DBRIS/Journey.pm @@ -93,7 +93,14 @@ sub new { # Number is either train no (ICE, RE) or line no (S, U, Bus, ...) # with no way of distinguishing between those if ( $ref->{trip} ) { - $ref->{number} = ( split( qr{\s+}, $ref->{trip} ) )[-1]; + my @trip_parts = split( qr{\s+}, $ref->{trip} ); + if ( not defined $ref->{type} ) { + $ref->{type} = $trip_parts[0]; + } + $ref->{number} = $trip_parts[-1]; + if ( not defined $ref->{trip_no} ) { + $ref->{trip_no} = $ref->{number}; + } } # For some trips, the type also contains the trip number like "MEX19161" @@ -234,6 +241,12 @@ sub operators { return @{ $self->{operators} // [] }; } +sub types { + my ($self) = @_; + + return @{ $self->{types} // [] }; +} + sub trip_numbers { my ($self) = @_; -- cgit v1.2.3