From f791a1ee6c52b94f6a8894362c683a33c9437bb9 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 21 Oct 2018 16:05:18 +0200 Subject: handle force checkout in history view --- templates/history.html.ep | 11 ++++++++--- templates/landingpage.html.ep | 6 ++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/templates/history.html.ep b/templates/history.html.ep index 24434d0..c7e6b6f 100644 --- a/templates/history.html.ep +++ b/templates/history.html.ep @@ -22,9 +22,14 @@ (+<%= ($travel->{rt_departure}->epoch - $travel->{sched_departure}->epoch) / 60 %>) % } - <%= $travel->{rt_arrival}->strftime('%H:%M') %> - % if ($travel->{sched_arrival} != $travel->{rt_arrival}) { - (+<%= ($travel->{rt_arrival}->epoch - $travel->{sched_arrival}->epoch) / 60 %>) + + % if ($travel->{rt_arrival}->epoch == 0 and $travel->{sched_arrival}->epoch == 0) { + timer_off + % } else { + %= $travel->{rt_arrival}->strftime('%H:%M'); + % if ($travel->{sched_arrival} != $travel->{rt_arrival}) { + (+<%= ($travel->{rt_arrival}->epoch - $travel->{sched_arrival}->epoch) / 60 %>) + % } % } diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep index c1d62d8..5d03262 100644 --- a/templates/landingpage.html.ep +++ b/templates/landingpage.html.ep @@ -52,11 +52,13 @@ <%= $travel->{sched_departure}->strftime('%d.%m.%Y') %> <%= $travel->{type} %> <%= $travel->{line} // $travel->{no} %> <%= $travel->{from_name} %> → <%= $travel->{to_name} %> - % if ($travel->{rt_arrival} and $travel->{rt_departure}) { + % if ($travel->{rt_arrival}->epoch and $travel->{rt_departure}->epoch) { <%= ($travel->{rt_arrival}->epoch - $travel->{rt_departure}->epoch) / 60 %> min % } else { - <%= sprintf('%.f', $self->get_travel_distance($travel->{from_name}, $travel->{to_name}, $travel->{route})) %>km + <%= sprintf('%.f', $self->get_travel_distance($travel->{from_name}, $travel->{to_name}, $travel->{route})) %>km + timer_off + % } % } -- cgit v1.2.3