From 36121ccffc8dc65b27bcfbe1299fb6a7f9a5f77c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 24 Jun 2019 18:02:45 +0200 Subject: [PATCH] show wagon order before departure --- lib/Travelynx.pm | 20 ++++++++++++++++++++ templates/_checked_in.html.ep | 10 ++++++++++ templates/changelog.html.ep | 5 +++++ 3 files changed, 35 insertions(+) diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index afeb880..df1d970 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -2264,6 +2264,7 @@ sub startup { for my $station (@route) { if ( $in_transit->{arr_name} + and @route_after and $station->[0] eq $in_transit->{arr_name} ) { $stop_before_dest = $route_after[-1][0]; @@ -2353,6 +2354,25 @@ sub startup { $ret->{departure_countdown} = $ret->{real_departure}->epoch - $now->epoch; + + if ( $ret->{departure_countdown} > 0 + and $in_transit->{data}{wagonorder_dep} ) + { + my $wr; + eval { + $wr + = Travel::Status::DE::DBWagenreihung->new( + from_json => $in_transit->{data}{wagonorder_dep} ); + }; + if ( $wr + and $wr->sections + and $wr->wagons + and defined $wr->direction ) + { + $ret->{wagonorder} = $wr; + } + } + if ( $in_transit->{real_arr_ts} ) { $ret->{arrival_countdown} = $ret->{real_arrival}->epoch - $now->epoch; diff --git a/templates/_checked_in.html.ep b/templates/_checked_in.html.ep index 91cd37a..0f1dcb2 100644 --- a/templates/_checked_in.html.ep +++ b/templates/_checked_in.html.ep @@ -44,6 +44,16 @@ % if ($journey->{departure_countdown} > 0 and $journey->{dep_platform}) {
von Gleis <%= $journey->{dep_platform} %> % } + % if (my $wr = $journey->{wagonorder}) { +
+ %= $wr->direction == 100 ? '→' : '←'; + % for my $wagon ($wr->wagons) { + % if (not ($wagon->is_locomotive or $wagon->is_powercar)) { + %= $wagon->number || $wagon->type + % } + % } + %= $wr->direction == 100 ? '→' : '←'; + % }
diff --git a/templates/changelog.html.ep b/templates/changelog.html.ep index ed0bff8..e511100 100644 --- a/templates/changelog.html.ep +++ b/templates/changelog.html.ep @@ -9,6 +9,11 @@ add Angabe der Ausstiegsseite für einzelne Züge und Zielbahnhöfe.

+

+ add Angabe der Wagenreihung vor der + Abfahrt. Derzeit sind Wagenreihungen nur für Fernverkehrszüge + verfügbar. +