summaryrefslogtreecommitdiff
path: root/lib/Travelynx.pm
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-09-07 21:19:43 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-09-07 21:19:43 +0200
commit2e14c2e3e4dafa976cecab2721682553d90eb01e (patch)
tree51f786b0738b3aea957e5ac6c79433fe6d09bc23 /lib/Travelynx.pm
parentb410176e634559bda0ff5d1628d45dc6ed3df5e3 (diff)
Fix intermediate stop display for journeys without real-time data, e.g. H-Bahn
Diffstat (limited to 'lib/Travelynx.pm')
-rwxr-xr-xlib/Travelynx.pm26
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 64a1e85..a6080b2 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -1593,21 +1593,17 @@ sub startup {
for my $station ( @{ $journey->{route_after} } ) {
my $station_desc = $station->[0];
- if ( $station->[2]{sched_arr} and $station->[2]{rt_arr} ) {
- $station_desc .= $station->[2]{sched_arr}->strftime(';%s');
- $station_desc .= $station->[2]{rt_arr}->strftime(';%s');
- if ( $station->[2]{sched_dep} and $station->[2]{rt_dep} ) {
- $station_desc
- .= $station->[2]{sched_dep}->strftime(';%s');
- $station_desc .= $station->[2]{rt_dep}->strftime(';%s');
- }
- else {
- $station_desc .= ';0;0';
- }
- }
- else {
- $station_desc .= ';0;0;0;0';
- }
+
+ my $sa = $station->[2]{sched_arr};
+ my $ra = $station->[2]{rt_arr} || $station->[2]{sched_arr};
+ my $sd = $station->[2]{sched_dep};
+ my $rd = $station->[2]{rt_dep} || $station->[2]{sched_dep};
+
+ $station_desc .= $sa ? $sa->strftime(';%s') : ';0';
+ $station_desc .= $ra ? $ra->strftime(';%s') : ';0';
+ $station_desc .= $sd ? $sd->strftime(';%s') : ';0';
+ $station_desc .= $rd ? $rd->strftime(';%s') : ';0';
+
push( @route, $station_desc );
}