show recent delay/qos messages in checked_in view

This commit is contained in:
Daniel Friesel 2019-04-24 14:58:08 +02:00
parent 501038ce11
commit aa0f9fdeea
2 changed files with 21 additions and 0 deletions

View file

@ -1272,8 +1272,18 @@ sub startup {
arr_ds100 => $in_transit->{arr_ds100}, arr_ds100 => $in_transit->{arr_ds100},
arr_name => $in_transit->{arr_name}, arr_name => $in_transit->{arr_name},
route_after => \@route_after, route_after => \@route_after,
messages => $in_transit->{messages}
? [ split( qr{[|]}, $in_transit->{messages} ) ]
: undef,
}; };
my @parsed_messages;
for my $message ( @{ $ret->{messages} // [] } ) {
my ( $ts, $msg ) = split( qr{:}, $message );
push( @parsed_messages, [ epoch_to_dt($ts), $msg ] );
}
$ret->{messages} = [ reverse @parsed_messages ];
$ret->{departure_countdown} $ret->{departure_countdown}
= $ret->{real_departure}->epoch - $now->epoch; = $ret->{real_departure}->epoch - $now->epoch;
if ( $in_transit->{real_arr_ts} ) { if ( $in_transit->{real_arr_ts} ) {

View file

@ -57,6 +57,17 @@
<div class="determinate white" style="width: <%= sprintf('%.2f', 100 * ($journey->{journey_completion} // 0)); %>%;"></div> <div class="determinate white" style="width: <%= sprintf('%.2f', 100 * ($journey->{journey_completion} // 0)); %>%;"></div>
</div> </div>
</p> </p>
% if (@{$journey->{messages} // []} > 0 and $journey->{messages}[0]) {
<p style="margin-bottom: 2ex;">
<ul>
% for my $message (reverse @{$journey->{messages} // []}) {
% if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) {
<li> <i class="material-icons tiny">warning</i> <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %></li>
% }
% }
</ul>
</p>
% }
% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) { % if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) {
<p> <p>
Der automatische Checkout erfolgt in wenigen Minuten. Zum Umsteigen: Der automatische Checkout erfolgt in wenigen Minuten. Zum Umsteigen: