From aa0f9fdeeacf87fcba54f4afa6c3cbf5cf80c43e Mon Sep 17 00:00:00 2001
From: Daniel Friesel
Date: Wed, 24 Apr 2019 14:58:08 +0200
Subject: show recent delay/qos messages in checked_in view
---
lib/Travelynx.pm | 10 ++++++++++
templates/_checked_in.html.ep | 11 +++++++++++
2 files changed, 21 insertions(+)
diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm
index 3f8025a..569b65f 100755
--- a/lib/Travelynx.pm
+++ b/lib/Travelynx.pm
@@ -1272,8 +1272,18 @@ sub startup {
arr_ds100 => $in_transit->{arr_ds100},
arr_name => $in_transit->{arr_name},
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->{real_departure}->epoch - $now->epoch;
if ( $in_transit->{real_arr_ts} ) {
diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep
index 3f47d71..9f2d1e2 100644
--- a/templates/_checked_in.html.ep
+++ b/templates/_checked_in.html.ep
@@ -57,6 +57,17 @@
+ % if (@{$journey->{messages} // []} > 0 and $journey->{messages}[0]) {
+
+
+ % for my $message (reverse @{$journey->{messages} // []}) {
+ % if ($journey->{sched_departure}->epoch - $message->[0]->epoch < 1800) {
+ - warning <%= $message->[0]->strftime('%H:%M') %>: <%= $message->[1] %>
+ % }
+ % }
+
+
+ % }
% if (defined $journey->{arrival_countdown} and $journey->{arrival_countdown} <= 0) {
Der automatische Checkout erfolgt in wenigen Minuten. Zum Umsteigen:
--
cgit v1.2.3