From e168d9cd39c38b8e5a1994c8bf11376d26e9ea77 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 23 Apr 2019 18:08:07 +0200 Subject: Use one row per journey instead of split checkin/checkout entries Whether a user is in transit or not is now determined by an entry in the in_transit table instead of a dangling checkin. All completed journeys are stored in the "journeys" table. This does most of the work needed for automatic checkout. However, note that the corresponding worker process is not implemented yet. --- templates/landingpage.html.ep | 86 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 73 insertions(+), 13 deletions(-) (limited to 'templates/landingpage.html.ep') diff --git a/templates/landingpage.html.ep b/templates/landingpage.html.ep index 5f69fd1..cd14f5c 100644 --- a/templates/landingpage.html.ep +++ b/templates/landingpage.html.ep @@ -14,26 +14,84 @@
% 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}) {
- Hallo, <%= current_user()->{name} %>! -

Du bist gerade eingecheckt in - <%= $status->{train_type} %> <%= $status->{train_no} %> - ab <%= $status->{station_name} %>. - % if ($status->{timestamp_delta} < 180) { - undo Rückgängig + Eingecheckt +

+ In <%= $status->{train_type} %> <%= $status->{train_no} %> + % if ($status->{arr_name}) { + von <%= $status->{dep_name} %> nach <%= $status->{arr_name} %>. % } -

-

Bei Ankunft: Station auswählen zum Auschecken.

+ % else { + ab <%= $status->{dep_name} %>. + % } +

+

+ Abfahrt + % if ($dep_wait > 0) { + in <%= int(($status->{real_departure}->epoch - $now->epoch)/60) %> Minute<%= $dep_wait >= 2 ? 'n' : '' %> + % } + um <%= $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) %>) + % } +

+

+ % if ($status->{real_arrival}->epoch) { + Voraussichtliche Ankunft um <%= $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) %>) + % } + % } + % else { + Ankunft: noch nicht bekannt + % } +

+

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

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

Zielstation ändern?

+ % } + % else { +

Zielstation wählen:

+ % } % my $is_after = 0; % for my $station (@{$status->{route_after}}) { - + % if ($status->{arr_name} and $station eq $status->{arr_name}) { + + % } + % else { + + % } % }
<%= $station %>
<%= $station %>
<%= $station %>
+ % if ($status->{arr_name}) { +

+ Falls das Backend ausgefallen ist oder der Zug aus anderen + Gründen verloren ging: Ohne Echtzeitdaten in <%= $status->{arr_name} %> + auschecken. +

+ % } +
+
% } @@ -44,9 +102,6 @@

Prinzipiell wärest du nun eingecheckt in <%= $status->{train_type} %> <%= $status->{train_no} %> ab <%= $status->{station_name} %>, doch dieser Zug fällt aus. - % if ($status->{timestamp_delta} < 180) { - undo Checkinversuch rückgängig - % }

Falls du den Zugausfall z.B. für ein Fahrgastrechteformular dokumentieren möchtest, wähle bitte jetzt deine geplante @@ -62,6 +117,11 @@

+
% } % else { @@ -91,7 +151,7 @@

Letzte Fahrten

- %= include '_history_trains', journeys => [get_user_travels(limit => 1)]; + %= include '_history_trains', journeys => [get_user_travels(limit => 5)]; % } % else {
-- cgit v1.2.3