Unverified Commit fd4b752e authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Journey: more train type edge cases (IC/ICE do not have kategorie, it seems)

parent 88227899
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -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) = @_;