From 4c6612a0656abcc930a82f2d4ea310e16186156c Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sat, 27 Apr 2024 14:05:06 +0200 Subject: set wagon->group_index even if train type is unknown --- lib/Travel/Status/DE/DBWagenreihung.pm | 6 ++---- lib/Travel/Status/DE/DBWagenreihung/Wagon.pm | 7 ++++++- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/Travel/Status/DE') diff --git a/lib/Travel/Status/DE/DBWagenreihung.pm b/lib/Travel/Status/DE/DBWagenreihung.pm index f3f7ad9..27ec01d 100644 --- a/lib/Travel/Status/DE/DBWagenreihung.pm +++ b/lib/Travel/Status/DE/DBWagenreihung.pm @@ -338,10 +338,8 @@ sub parse_wagons { for my $i ( 0 .. $#wagon_groups ) { my $group = $wagon_groups[$i]; my $tt = $self->wagongroup_subtype( @{$group} ); - if ($tt) { - for my $wagon ( @{$group} ) { - $wagon->set_traintype( $i, $tt ); - } + for my $wagon ( @{$group} ) { + $wagon->set_traintype( $i, $tt ); } } diff --git a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm index 27f2e36..646028f 100644 --- a/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm +++ b/lib/Travel/Status/DE/DBWagenreihung/Wagon.pm @@ -203,7 +203,12 @@ sub parse_type { sub set_traintype { my ( $self, $group_index, $tt ) = @_; - $self->{group_index} = $group_index; + $self->{group_index} = $group_index; + + if ( not $tt ) { + return; + } + $self->{train_subtype} = $tt; if ( not $self->{number} or not exists( $type_attributes{$tt} ) ) { -- cgit v1.2.3