Fix intermediate stop display for journeys without real-time data, e.g. H-Bahn
This commit is contained in:
parent
b410176e63
commit
2e14c2e3e4
4 changed files with 55 additions and 55 deletions
|
@ -1593,21 +1593,17 @@ sub startup {
|
||||||
|
|
||||||
for my $station ( @{ $journey->{route_after} } ) {
|
for my $station ( @{ $journey->{route_after} } ) {
|
||||||
my $station_desc = $station->[0];
|
my $station_desc = $station->[0];
|
||||||
if ( $station->[2]{sched_arr} and $station->[2]{rt_arr} ) {
|
|
||||||
$station_desc .= $station->[2]{sched_arr}->strftime(';%s');
|
my $sa = $station->[2]{sched_arr};
|
||||||
$station_desc .= $station->[2]{rt_arr}->strftime(';%s');
|
my $ra = $station->[2]{rt_arr} || $station->[2]{sched_arr};
|
||||||
if ( $station->[2]{sched_dep} and $station->[2]{rt_dep} ) {
|
my $sd = $station->[2]{sched_dep};
|
||||||
$station_desc
|
my $rd = $station->[2]{rt_dep} || $station->[2]{sched_dep};
|
||||||
.= $station->[2]{sched_dep}->strftime(';%s');
|
|
||||||
$station_desc .= $station->[2]{rt_dep}->strftime(';%s');
|
$station_desc .= $sa ? $sa->strftime(';%s') : ';0';
|
||||||
}
|
$station_desc .= $ra ? $ra->strftime(';%s') : ';0';
|
||||||
else {
|
$station_desc .= $sd ? $sd->strftime(';%s') : ';0';
|
||||||
$station_desc .= ';0;0';
|
$station_desc .= $rd ? $rd->strftime(';%s') : ';0';
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$station_desc .= ';0;0;0;0';
|
|
||||||
}
|
|
||||||
push( @route, $station_desc );
|
push( @route, $station_desc );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,9 +270,11 @@ sub postprocess {
|
||||||
if ( $times->{rt_arr} ) {
|
if ( $times->{rt_arr} ) {
|
||||||
$times->{rt_arr}
|
$times->{rt_arr}
|
||||||
= epoch_to_dt( $times->{rt_arr} );
|
= epoch_to_dt( $times->{rt_arr} );
|
||||||
$times->{rt_arr_countdown}
|
$times->{arr_delay}
|
||||||
= $times->{rt_arr}->epoch - $epoch;
|
= $times->{rt_arr}->epoch - $times->{sched_arr}->epoch;
|
||||||
}
|
}
|
||||||
|
$times->{arr} = $times->{rt_arr} || $times->{sched_arr};
|
||||||
|
$times->{arr_countdown} = $times->{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' )
|
||||||
|
@ -282,9 +284,11 @@ sub postprocess {
|
||||||
if ( $times->{rt_dep} ) {
|
if ( $times->{rt_dep} ) {
|
||||||
$times->{rt_dep}
|
$times->{rt_dep}
|
||||||
= epoch_to_dt( $times->{rt_dep} );
|
= epoch_to_dt( $times->{rt_dep} );
|
||||||
$times->{rt_dep_countdown}
|
$times->{dep_delay}
|
||||||
= $times->{rt_dep}->epoch - $epoch;
|
= $times->{rt_dep}->epoch - $times->{sched_dep}->epoch;
|
||||||
}
|
}
|
||||||
|
$times->{dep} = $times->{rt_dep} || $times->{sched_dep};
|
||||||
|
$times->{dep_countdown} = $times->{dep}->epoch - $epoch;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,19 +127,19 @@
|
||||||
% if ($station->[0] eq $journey->{arr_name}) {
|
% if ($station->[0] eq $journey->{arr_name}) {
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
% if (($station->[2]{rt_arr_countdown} // 0) > 0 and $station->[2]{rt_arr}) {
|
% if (($station->[2]{arr_countdown} // 0) > 0 and $station->[2]{arr}) {
|
||||||
<%= $station->[0] %><br/><%= $station->[2]{rt_arr}->strftime('%H:%M') %>
|
<%= $station->[0] %><br/><%= $station->[2]{arr}->strftime('%H:%M') %>
|
||||||
% if ($station->[2]{sched_arr} and $station->[2]{sched_arr}->epoch != $station->[2]{rt_arr}->epoch) {
|
% if ($station->[2]{arr_delay}) {
|
||||||
%= sprintf('(%+d)', ($station->[2]{rt_arr}->epoch - $station->[2]{sched_arr}->epoch ) / 60);
|
%= sprintf('(%+d)', $station->[2]{arr_delay} / 60);
|
||||||
% }
|
% }
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
% if (($station->[2]{rt_dep_countdown} // 0) > 0 and $station->[2]{rt_arr} and $station->[2]{rt_dep}) {
|
% if (($station->[2]{dep_countdown} // 0) > 0 and $station->[2]{arr} and $station->[2]{dep}) {
|
||||||
<%= $station->[0] %><br/>
|
<%= $station->[0] %><br/>
|
||||||
<%= $station->[2]{rt_arr}->strftime('%H:%M') %> →
|
<%= $station->[2]{arr}->strftime('%H:%M') %> →
|
||||||
<%= $station->[2]{rt_dep}->strftime('%H:%M') %>
|
<%= $station->[2]{dep}->strftime('%H:%M') %>
|
||||||
% if ($station->[2]{sched_dep} and $station->[2]{sched_dep}->epoch != $station->[2]{rt_dep}->epoch) {
|
% if ($station->[2]{dep_delay}) {
|
||||||
%= sprintf('(%+d)', ($station->[2]{rt_dep}->epoch - $station->[2]{sched_dep}->epoch ) / 60);
|
%= sprintf('(%+d)', $station->[2]{dep_dely} / 60);
|
||||||
% }
|
% }
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
|
@ -152,19 +152,19 @@
|
||||||
% if ($station->[0] eq $journey->{arr_name}) {
|
% if ($station->[0] eq $journey->{arr_name}) {
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
% if (($station->[2]{rt_arr_countdown} // 0) > 0 and $station->[2]{rt_arr}) {
|
% if (($station->[2]{arr_countdown} // 0) > 0 and $station->[2]{arr}) {
|
||||||
<%= $station->[0] %><br/><%= $station->[2]{rt_arr}->strftime('%H:%M') %>
|
<%= $station->[0] %><br/><%= $station->[2]{arr}->strftime('%H:%M') %>
|
||||||
% if ($station->[2]{sched_arr} and $station->[2]{sched_arr}->epoch != $station->[2]{rt_arr}->epoch) {
|
% if ($station->[2]{arr_delay}) {
|
||||||
%= sprintf('(%+d)', ($station->[2]{rt_arr}->epoch - $station->[2]{sched_arr}->epoch ) / 60);
|
%= sprintf('(%+d)', $station->[2]{arr_delay} / 60);
|
||||||
% }
|
% }
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
% if (($station->[2]{rt_dep_countdown} // 0) > 0 and $station->[2]{rt_arr} and $station->[2]{rt_dep}) {
|
% if (($station->[2]{dep_countdown} // 0) > 0 and $station->[2]{arr} and $station->[2]{dep}) {
|
||||||
<%= $station->[0] %><br/>
|
<%= $station->[0] %><br/>
|
||||||
<%= $station->[2]{rt_arr}->strftime('%H:%M') %> →
|
<%= $station->[2]{arr}->strftime('%H:%M') %> →
|
||||||
<%= $station->[2]{rt_dep}->strftime('%H:%M') %>
|
<%= $station->[2]{dep}->strftime('%H:%M') %>
|
||||||
% if ($station->[2]{sched_dep} and $station->[2]{sched_dep}->epoch != $station->[2]{rt_dep}->epoch) {
|
% if ($station->[2]{dep_delay}) {
|
||||||
%= sprintf('(%+d)', ($station->[2]{rt_dep}->epoch - $station->[2]{sched_dep}->epoch ) / 60);
|
%= sprintf('(%+d)', $station->[2]{dep_delay} / 60);
|
||||||
% }
|
% }
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
|
|
|
@ -88,19 +88,19 @@
|
||||||
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
|
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
% if (($station->[2]{rt_arr_countdown} // 0) > 0 and $station->[2]{rt_arr}) {
|
% if (($station->[2]{arr_countdown} // 0) > 0 and $station->[2]{arr}) {
|
||||||
<%= $station->[0] %><br/><%= $station->[2]{rt_arr}->strftime('%H:%M') %>
|
<%= $station->[0] %><br/><%= $station->[2]{arr}->strftime('%H:%M') %>
|
||||||
% if ($station->[2]{sched_arr} and $station->[2]{sched_arr}->epoch != $station->[2]{rt_arr}->epoch) {
|
% if ($station->[2]{arr_delay}) {
|
||||||
%= sprintf('(%+d)', ($station->[2]{rt_arr}->epoch - $station->[2]{sched_arr}->epoch ) / 60);
|
%= sprintf('(%+d)', $station->[2]{arr_delay} / 60);
|
||||||
% }
|
% }
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
% if (($station->[2]{rt_dep_countdown} // 0) > 0 and $station->[2]{rt_arr} and $station->[2]{rt_dep}) {
|
% if (($station->[2]{dep_countdown} // 0) > 0 and $station->[2]{arr} and $station->[2]{dep}) {
|
||||||
<%= $station->[0] %><br/>
|
<%= $station->[0] %><br/>
|
||||||
<%= $station->[2]{rt_arr}->strftime('%H:%M') %> →
|
<%= $station->[2]{arr}->strftime('%H:%M') %> →
|
||||||
<%= $station->[2]{rt_dep}->strftime('%H:%M') %>
|
<%= $station->[2]{dep}->strftime('%H:%M') %>
|
||||||
% if ($station->[2]{sched_dep} and $station->[2]{sched_dep}->epoch != $station->[2]{rt_dep}->epoch) {
|
% if ($station->[2]{dep_delay}) {
|
||||||
%= sprintf('(%+d)', ($station->[2]{rt_dep}->epoch - $station->[2]{sched_dep}->epoch ) / 60);
|
%= sprintf('(%+d)', $station->[2]{dep_delay} / 60);
|
||||||
% }
|
% }
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
|
@ -113,21 +113,21 @@
|
||||||
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
|
% if ($journey->{arr_name} and $station->[0] eq $journey->{arr_name}) {
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
% if (($station->[2]{rt_arr_countdown} // 0) > 0 and $station->[2]{rt_arr}) {
|
% if (($station->[2]{arr_countdown} // 0) > 0 and $station->[2]{arr}) {
|
||||||
Nächster Halt:<br/>
|
Nächster Halt:<br/>
|
||||||
<%= $station->[0] %><br/><%= $station->[2]{rt_arr}->strftime('%H:%M') %>
|
<%= $station->[0] %><br/><%= $station->[2]{arr}->strftime('%H:%M') %>
|
||||||
% if ($station->[2]{sched_arr} and $station->[2]{sched_arr}->epoch != $station->[2]{rt_arr}->epoch) {
|
% if ($station->[2]{arr_delay}) {
|
||||||
%= sprintf('(%+d)', ($station->[2]{rt_arr}->epoch - $station->[2]{sched_arr}->epoch ) / 60);
|
%= sprintf('(%+d)', $station->[2]{arr_delay} / 60);
|
||||||
% }
|
% }
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
% if (($station->[2]{rt_dep_countdown} // 0) > 0 and $station->[2]{rt_arr} and $station->[2]{rt_dep}) {
|
% if (($station->[2]{dep_countdown} // 0) > 0 and $station->[2]{arr} and $station->[2]{dep}) {
|
||||||
Aktueller Halt:<br/>
|
Aktueller Halt:<br/>
|
||||||
<%= $station->[0] %><br/>
|
<%= $station->[0] %><br/>
|
||||||
<%= $station->[2]{rt_arr}->strftime('%H:%M') %> →
|
<%= $station->[2]{arr}->strftime('%H:%M') %> →
|
||||||
<%= $station->[2]{rt_dep}->strftime('%H:%M') %>
|
<%= $station->[2]{dep}->strftime('%H:%M') %>
|
||||||
% if ($station->[2]{sched_dep} and $station->[2]{sched_dep}->epoch != $station->[2]{rt_dep}->epoch) {
|
% if ($station->[2]{dep_delay}) {
|
||||||
%= sprintf('(%+d)', ($station->[2]{rt_dep}->epoch - $station->[2]{sched_dep}->epoch ) / 60);
|
%= sprintf('(%+d)', $station->[2]{dep_delay} / 60);
|
||||||
% }
|
% }
|
||||||
% last;
|
% last;
|
||||||
% }
|
% }
|
||||||
|
|
Loading…
Reference in a new issue