diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2023-12-16 19:40:47 +0100 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2023-12-16 19:40:47 +0100 |
commit | 00788ac379e995928521eb9aaf9be30c7540771a (patch) | |
tree | ebcdce752ff4572a58f6d7cdfeefbbd9aae08159 /lib/Travel/Status/DE/HAFAS | |
parent | e8e22fd6cd102cee2b3fb7e4aa800d15184f104f (diff) |
Journey: Fix route_interesting (broken by 5.00); do not modify Locations
Diffstat (limited to 'lib/Travel/Status/DE/HAFAS')
-rw-r--r-- | lib/Travel/Status/DE/HAFAS/Journey.pm | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Travel/Status/DE/HAFAS/Journey.pm b/lib/Travel/Status/DE/HAFAS/Journey.pm index f09a367..446af1a 100644 --- a/lib/Travel/Status/DE/HAFAS/Journey.pm +++ b/lib/Travel/Status/DE/HAFAS/Journey.pm @@ -299,7 +299,7 @@ sub route_interesting { # HB: swiss main station (Hbf in .ch) # hl.n.: czech main station (Hbf in .cz) for my $stop (@via) { - if ( $stop->{name} + if ( $stop->loc->name =~ m{ HB $ | hl\.n\. $ | Hbf | Hauptbahnhof | Bf | Bahnhof | Centraal | Flughafen }x ) { @@ -308,14 +308,15 @@ sub route_interesting { } $last_stop = pop(@via); - if ( @via_main and $via_main[-1]{name} eq $last_stop->{name} ) { + if ( @via_main and $via_main[-1]->loc->name eq $last_stop->loc->name ) { pop(@via_main); } - if ( @via and $via[-1]{name} eq $last_stop->{name} ) { + if ( @via and $via[-1]->loc->name eq $last_stop->loc->name ) { pop(@via); } - if ( @via_main and @via and $via[0]{name} eq $via_main[0]{name} ) { + if ( @via_main and @via and $via[0]->loc->name eq $via_main[0]->loc->name ) + { shift(@via_main); } @@ -332,8 +333,8 @@ sub route_interesting { while ( @via_show < $max_parts and @via_main ) { my $stop = shift(@via_main); - if ( any { $_->{name} eq $stop->{name} } @via_show - or $stop->{name} eq $last_stop->{name} ) + if ( any { $_->loc->name eq $stop->loc->name } @via_show + or $stop->loc->name eq $last_stop->loc->name ) { next; } @@ -341,10 +342,6 @@ sub route_interesting { } } - for my $stop (@via_show) { - $stop->{name} =~ s{ \s? Hbf .* }{}x; - } - return @via_show; } |