summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-12-01 20:34:44 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2025-12-01 20:34:44 +0100
commitfd4b752e6912147b9e2baba5dc252cc04ce9452c (patch)
tree4ed1923f5f70fa1da623a4dc7221ea0891f23f11 /lib
parent88227899bce6ad89478479d64fcc7a84b5a29eed (diff)
Journey: more train type edge cases (IC/ICE do not have kategorie, it seems)
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/DBRIS/Journey.pm15
1 files changed, 14 insertions, 1 deletions
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) = @_;