route: handle stops without real-time data
This commit is contained in:
parent
0a37788fef
commit
df74dd5cf9
2 changed files with 22 additions and 11 deletions
|
@ -1528,29 +1528,34 @@ sub startup {
|
||||||
for my $station (@route_after) {
|
for my $station (@route_after) {
|
||||||
if ( @{$station} > 1 ) {
|
if ( @{$station} > 1 ) {
|
||||||
|
|
||||||
# Note: $station->[1]{sched_arr} may already have been
|
# Note: $station->[1]{sched_arr} may already have been
|
||||||
# converted to a DateTime object in $station->[1] is
|
# converted to a DateTime object. This can happen when a
|
||||||
# $dep_info. This can happen when a station is present
|
# station is present several times in a train's route, e.g.
|
||||||
# several times in a train's route, e.g. for Frankfurt
|
# for Frankfurt Flughafen in some nightly connections.
|
||||||
# Flughafen in some nightly connections.
|
|
||||||
my $times = $station->[1];
|
my $times = $station->[1];
|
||||||
if ( $times->{sched_arr}
|
if ( $times->{sched_arr}
|
||||||
and ref( $times->{sched_arr} ) ne 'DateTime' )
|
and ref( $times->{sched_arr} ) ne 'DateTime' )
|
||||||
{
|
{
|
||||||
$times->{sched_arr}
|
$times->{sched_arr}
|
||||||
= epoch_to_dt( $times->{sched_arr} );
|
= epoch_to_dt( $times->{sched_arr} );
|
||||||
$times->{rt_arr} = epoch_to_dt( $times->{rt_arr} );
|
if ( $times->{rt_arr} ) {
|
||||||
$times->{rt_arr_countdown}
|
$times->{rt_arr}
|
||||||
= $times->{rt_arr}->epoch - $epoch;
|
= epoch_to_dt( $times->{rt_arr} );
|
||||||
|
$times->{rt_arr_countdown}
|
||||||
|
= $times->{rt_arr}->epoch - $epoch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ( $times->{sched_dep}
|
if ( $times->{sched_dep}
|
||||||
and ref( $times->{sched_dep} ) ne 'DateTime' )
|
and ref( $times->{sched_dep} ) ne 'DateTime' )
|
||||||
{
|
{
|
||||||
$times->{sched_dep}
|
$times->{sched_dep}
|
||||||
= epoch_to_dt( $times->{sched_dep} );
|
= epoch_to_dt( $times->{sched_dep} );
|
||||||
$times->{rt_dep} = epoch_to_dt( $times->{rt_dep} );
|
if ( $times->{rt_dep} ) {
|
||||||
$times->{rt_dep_countdown}
|
$times->{rt_dep}
|
||||||
= $times->{rt_dep}->epoch - $epoch;
|
= epoch_to_dt( $times->{rt_dep} );
|
||||||
|
$times->{rt_dep_countdown}
|
||||||
|
= $times->{rt_dep}->epoch - $epoch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,6 +225,9 @@
|
||||||
% elsif ($station->[1]{rt_arr}) {
|
% elsif ($station->[1]{rt_arr}) {
|
||||||
<span><%= $station->[1]{rt_arr}->strftime('%H:%M') %></span>
|
<span><%= $station->[1]{rt_arr}->strftime('%H:%M') %></span>
|
||||||
% }
|
% }
|
||||||
|
% elsif ($station->[1]{sched_arr}) {
|
||||||
|
<span><%= $station->[1]{sched_arr}->strftime('%H:%M') %></span>
|
||||||
|
% }
|
||||||
% elsif ($station->[2] and $station->[2] eq 'additional') {
|
% elsif ($station->[2] and $station->[2] eq 'additional') {
|
||||||
<span>Zusatzhalt</span>
|
<span>Zusatzhalt</span>
|
||||||
% }
|
% }
|
||||||
|
@ -331,6 +334,9 @@
|
||||||
% elsif ($station->[1]{rt_arr}) {
|
% elsif ($station->[1]{rt_arr}) {
|
||||||
<span><%= $station->[1]{rt_arr}->strftime('%H:%M') %></span>
|
<span><%= $station->[1]{rt_arr}->strftime('%H:%M') %></span>
|
||||||
% }
|
% }
|
||||||
|
% elsif ($station->[1]{sched_arr}) {
|
||||||
|
<span><%= $station->[1]{sched_arr}->strftime('%H:%M') %></span>
|
||||||
|
% }
|
||||||
% elsif ($station->[2] and $station->[2] eq 'additional') {
|
% elsif ($station->[2] and $station->[2] eq 'additional') {
|
||||||
<span>Zusatzhalt</span>
|
<span>Zusatzhalt</span>
|
||||||
% }
|
% }
|
||||||
|
|
Loading…
Reference in a new issue