summaryrefslogtreecommitdiff
path: root/lib/Travel
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-09-22 09:32:24 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-09-22 09:32:24 +0200
commita8eb30553b5ce27ce9217bb90dca773cf1d30bf8 (patch)
tree65d6209f81086b9fcc3f3b09470dba87a8a4739c /lib/Travel
parentb7df6c0434d296d06aab2227925aa6e61d36470a (diff)
prevStopSeq, onwardStopSeq: remove requested stop from results
Diffstat (limited to 'lib/Travel')
-rw-r--r--lib/Travel/Status/DE/EFA.pm13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index 0f2bdee..ada0ea3 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -410,7 +410,7 @@ sub parse_line {
}
sub parse_route {
- my ( $self, $stop_seq ) = @_;
+ my ( $self, $stop_seq, $requested_id ) = @_;
my @ret;
if ( not $stop_seq ) {
@@ -419,6 +419,11 @@ sub parse_route {
# Oh EFA, you so silly
if ( ref($stop_seq) eq 'HASH' ) {
+
+ # For lines that start or terminate at the requested stop, onwardStopSeq / prevStopSeq includes the requested stop.
+ if ( $stop_seq->{ref}{id} eq $requested_id ) {
+ return \@ret;
+ }
$stop_seq = [$stop_seq];
}
@@ -488,10 +493,12 @@ sub parse_departure {
}
if ( $departure->{prevStopSeq} ) {
- $prev_route = $self->parse_route( $departure->{prevStopSeq} );
+ $prev_route = $self->parse_route( $departure->{prevStopSeq},
+ $departure->{stopID} );
}
if ( $departure->{onwardStopSeq} ) {
- $next_route = $self->parse_route( $departure->{onwardStopSeq} );
+ $next_route = $self->parse_route( $departure->{onwardStopSeq},
+ $departure->{stopID} );
}
return Travel::Status::DE::EFA::Departure->new(