From ffaa0c44a78bb4bab632fcb76b668215da4c0a82 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 23 Apr 2019 21:30:31 +0200 Subject: Automatic checkout \o/ --- templates/landingpage.html.ep | 46 ++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 20 deletions(-) (limited to 'templates') diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep index 26bae8d..84514c5 100644 --- a/templates/landingpage.html.ep +++ b/templates/landingpage.html.ep @@ -14,12 +14,6 @@
% my $status = get_user_status(); - % my $now = DateTime->now(time_zone => 'Europe/Berlin'); - % my $dep_wait = ($status->{real_departure}->epoch - $now->epoch)/60; - % my $arr_wait = undef; - % if ($status->{real_arrival}->epoch) { - % $arr_wait = ($status->{real_arrival}->epoch - $now->epoch)/60; - % } % if ($status->{checked_in}) {
@@ -34,30 +28,42 @@ % }

- Abfahrt - % if ($dep_wait > 0) { - in <%= int(($status->{real_departure}->epoch - $now->epoch)/60) %> Minute<%= $dep_wait == 1 ? '' : 'n' %> - % } - um <%= $status->{real_departure}->strftime('%H:%M') %> + <%= $status->{real_departure}->strftime('%H:%M') %> % if ($status->{real_departure}->epoch != $status->{sched_departure}->epoch) { - (+<%= int(($status->{real_departure}->epoch - $status->{sched_departure}->epoch)/60) %>) + (<%= sprintf('%+d', ($status->{real_departure}->epoch - $status->{sched_departure}->epoch)/60) %>) % } -

-

+ → % if ($status->{real_arrival}->epoch) { - Voraussichtliche Ankunft um <%= $status->{real_arrival}->strftime('%H:%M') %> + <%= $status->{real_arrival}->strftime('%H:%M') %> % if ($status->{real_arrival}->epoch != $status->{sched_arrival}->epoch) { - (+<%= int(($status->{real_arrival}->epoch - $status->{sched_arrival}->epoch)/60) %>) + (<%= sprintf('%+d', ($status->{real_arrival}->epoch - $status->{sched_arrival}->epoch)/60) %>) % } % } % else { - Ankunft: noch nicht bekannt + unbekannt % }

- Achtung: Automatischer Checkout ist noch nicht - implementiert. Bitte spätestens eine Stunde nach Ankunft - am Ziel manuell auschecken. +

+ % if ($status->{departure_countdown} > 120) { + Abfahrt in <%= int($status->{departure_countdown} / 60) %> Minuten + % } + % elsif ($status->{arrival_countdown}) { + % if ($status->{arrival_countdown} > 0) { + Ankunft in <%= int($status->{arrival_countdown} / 60) %> + Minute<%= int($status->{arrival_countdown} / 60) == 1 ? '' : 'n' %> + % } + % else { + Ziel erreicht + % } + % } + % elsif ($status->{arr_name}) { + Ankunft in mehr als zwei Stunden + % } +
+
+
+

% if ($status->{arr_name}) {

Zielstation ändern?

-- cgit v1.2.3