From c92b6bc9492d1d2cd8147354885d0a89f0fbfdb9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 11 Nov 2022 19:01:24 +0100 Subject: status card: handle missing realtime data --- templates/_checked_in.html.ep | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'templates/_checked_in.html.ep') diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep index 2a6ac1d..761849d 100644 --- a/templates/_checked_in.html.ep +++ b/templates/_checked_in.html.ep @@ -124,18 +124,18 @@ % if ($station->[0] eq $journey->{arr_name}) { % last; % } - % if (($station->[1]{rt_arr_countdown} // 0) > 0) { + % if (($station->[1]{rt_arr_countdown} // 0) > 0 and $station->[1]{rt_arr}) { <%= $station->[0] %>
<%= $station->[1]{rt_arr}->strftime('%H:%M') %> - % if ($station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) { + % if ($station->[1]{sched_arr} and $station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) { %= sprintf('(%+d)', ($station->[1]{rt_arr}->epoch - $station->[1]{sched_arr}->epoch ) / 60); % } % last; % } - % if (($station->[1]{rt_dep_countdown} // 0) > 0) { + % if (($station->[1]{rt_dep_countdown} // 0) > 0 and $station->[1]{rt_arr} and $station->[1]{rt_dep}) { <%= $station->[0] %>
<%= $station->[1]{rt_arr}->strftime('%H:%M') %> → <%= $station->[1]{rt_dep}->strftime('%H:%M') %> - % if ($station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) { + % if ($station->[1]{sched_dep} and $station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) { %= sprintf('(%+d)', ($station->[1]{rt_dep}->epoch - $station->[1]{sched_dep}->epoch ) / 60); % } % last; @@ -149,18 +149,18 @@ % if ($station->[0] eq $journey->{arr_name}) { % last; % } - % if (($station->[1]{rt_arr_countdown} // 0) > 0) { + % if (($station->[1]{rt_arr_countdown} // 0) > 0 and $station->[1]{rt_arr}) { <%= $station->[0] %>
<%= $station->[1]{rt_arr}->strftime('%H:%M') %> - % if ($station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) { + % if ($station->[1]{sched_arr} and $station->[1]{sched_arr}->epoch != $station->[1]{rt_arr}->epoch) { %= sprintf('(%+d)', ($station->[1]{rt_arr}->epoch - $station->[1]{sched_arr}->epoch ) / 60); % } % last; % } - % if (($station->[1]{rt_dep_countdown} // 0) > 0) { + % if (($station->[1]{rt_dep_countdown} // 0) > 0 and $station->[1]{rt_arr} and $station->[1]{rt_dep}) { <%= $station->[0] %>
<%= $station->[1]{rt_arr}->strftime('%H:%M') %> → <%= $station->[1]{rt_dep}->strftime('%H:%M') %> - % if ($station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) { + % if ($station->[1]{sched_dep} and $station->[1]{sched_dep}->epoch != $station->[1]{rt_dep}->epoch) { %= sprintf('(%+d)', ($station->[1]{rt_dep}->epoch - $station->[1]{sched_dep}->epoch ) / 60); % } % last; -- cgit v1.2.3