Skip to content

Commit

Permalink
route_after: handle passing the same stop more than once
Browse files Browse the repository at this point in the history
  • Loading branch information
derf committed May 22, 2024
1 parent cd6df2a commit 4764fd9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/Travelynx/Model/InTransit.pm
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,15 @@ sub postprocess {
if ($is_after) {
push( @route_after, $station );
}
if ( $ret->{dep_name}
and $station->[0] eq $ret->{dep_name} )

# Note that the departure stop may be present more than once in @route,
# e.g. when traveling along ring lines such as S41 / S42 in Berlin.
if (
$ret->{dep_name}
and $station->[0] eq $ret->{dep_name}
and not($station->[2]{sched_dep}
and $station->[2]{sched_dep} < $ret->{sched_dep_ts} )
)
{
$is_after = 1;
if ( @{$station} > 1 and not $dep_info ) {
Expand Down

0 comments on commit 4764fd9

Please sign in to comment.