journey: show times of intermediate stops, if available

This commit is contained in:
Derf Null 2023-05-01 10:06:30 +02:00
parent c862478645
commit e4a07dc06c
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
2 changed files with 30 additions and 1 deletions

View file

@ -626,6 +626,13 @@ sub get {
$ref->{checkout} = epoch_to_dt( $ref->{checkout_ts} ); $ref->{checkout} = epoch_to_dt( $ref->{checkout_ts} );
$ref->{sched_arrival} = epoch_to_dt( $ref->{sched_arr_ts} ); $ref->{sched_arrival} = epoch_to_dt( $ref->{sched_arr_ts} );
$ref->{rt_arrival} = epoch_to_dt( $ref->{rt_arr_ts} ); $ref->{rt_arrival} = epoch_to_dt( $ref->{rt_arr_ts} );
for my $stop ( @{ $ref->{route} } ) {
for my $k (qw(rt_arr rt_dep sched_arr sched_dep)) {
if ( $stop->[2]{$k} ) {
$stop->[2]{$k} = epoch_to_dt( $stop->[2]{$k} );
}
}
}
} }
if ( $opt{verbose} ) { if ( $opt{verbose} ) {

View file

@ -208,6 +208,7 @@
<tr> <tr>
<th scope="row">Route</th> <th scope="row">Route</th>
<td> <td>
% my $before = 1;
% my $within = 0; % my $within = 0;
% my $at_startstop = 0; % my $at_startstop = 0;
% for my $station (@{$journey->{route}}) { % for my $station (@{$journey->{route}}) {
@ -220,8 +221,16 @@
% else { % else {
% $at_startstop = 0; % $at_startstop = 0;
% } % }
<span style="color: #808080;">
% if ($before and $station->[2]{sched_dep}) {
%= $station->[2]{sched_dep}->strftime('%H:%M')
% }
% elsif (not $before and $station->[2]{sched_arr}) {
%= $station->[2]{sched_arr}->strftime('%H:%M')
% }
</span>
% if ($at_startstop or $within) { % if ($at_startstop or $within) {
<%= $station->[0] %> %= $station->[0]
% } % }
% else { % else {
<span style="color: #808080;"><%= $station->[0] %></span> <span style="color: #808080;"><%= $station->[0] %></span>
@ -229,6 +238,19 @@
% if ($journey->{edited} & 0x0010) { % if ($journey->{edited} & 0x0010) {
% } % }
% if ($within or $at_startstop) {
<span style="color: #808080;">
% if ($before and $station->[2]{rt_dep} and $station->[2]{dep_delay}) {
%= sprintf('%+d → %s', $station->[2]{dep_delay}, $station->[2]{rt_dep}->strftime('%H:%M'))
% }
% elsif (not $before and $station->[2]{rt_arr} and $station->[2]{arr_delay}) {
%= sprintf('%+d → %s', $station->[2]{arr_delay}, $station->[2]{rt_arr}->strftime('%H:%M'))
% }
</span>
% }
% if ($station->[0] eq $journey->{from_name}) {
% $before = 0;
% }
<br/> <br/>
% } % }
</td> </td>