From 08d77279a5af8a600f2938794aa2019b59f6e3e5 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 25 May 2025 11:01:30 +0200 Subject: status card: show complete route and expected load --- lib/Travelynx/Model/InTransit.pm | 2 +- templates/_public_status_card.html.ep | 55 +++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/lib/Travelynx/Model/InTransit.pm b/lib/Travelynx/Model/InTransit.pm index 1ec7137..2bd3dad 100644 --- a/lib/Travelynx/Model/InTransit.pm +++ b/lib/Travelynx/Model/InTransit.pm @@ -392,7 +392,7 @@ sub postprocess { = $dep_info->{rt_arr}->epoch - $epoch; } - for my $station (@route_after) { + for my $station (@route) { if ( @{$station} > 1 ) { # Note: $station->[2]{sched_arr} may already have been diff --git a/templates/_public_status_card.html.ep b/templates/_public_status_card.html.ep index 280d4dd..e8b6fbb 100644 --- a/templates/_public_status_card.html.ep +++ b/templates/_public_status_card.html.ep @@ -197,13 +197,62 @@ % } - % if ( $journey->{wagongroups} and @{$journey->{wagongroups}} and not stash('from_timeline')) { -
+ % if ( @{$journey->{wagongroups} // []} and not stash('from_timeline')) { +
+ Wagen:
%= include '_wagons', wagongroups => $journey->{wagongroups};
% } + % if (not stash('from_timeline')) { +
+ Zuglauf:
+ % my $before = 1; + % my $within = 0; + % my $at_startstop = 0; + % for my $station (@{$journey->{route}}) { + % if (($station->[1] and $station->[1] == $journey->{dep_eva}) or $station->[0] eq $journey->{dep_name}) { + % $within = 1; $at_startstop = 1; + % } + % elsif (($station->[1] and $station->[1] == $journey->{arr_eva}) or $station->[0] eq $journey->{arr_name}) { + % $within = 0; $at_startstop = 1; + % } + % else { + % $at_startstop = 0; + % } + + % if ($before and $station->[2]{sched_dep}) { + %= $station->[2]{sched_dep}->strftime('%H:%M') + % } + % elsif (not $before and $station->[2]{sched_arr}) { + %= $station->[2]{sched_arr}->strftime('%H:%M') + % } + + % if ($at_startstop or $within) { + %= $station->[0] + % } + % else { + <%= $station->[0] %> + % } + + %= include '_show_load_icons', station => $station + + + % if ($before and $station->[2]{rt_dep} and $station->[2]{dep_delay}) { + %= sprintf('%+d', $station->[2]{dep_delay} / 60) + % } + % elsif (not $before and $station->[2]{rt_arr} and $station->[2]{arr_delay}) { + %= sprintf('%+d', $station->[2]{arr_delay} / 60) + % } + + % if (($station->[1] and $station->[1] == $journey->{dep_eva}) or $station->[0] eq $journey->{dep_name}) { + % $before = 0; + % } +
+ % } +
+ % }
- % if (not stash('from_timeline')) { + % if (0 and not stash('from_timeline')) {
% if ($journey->{traewelling_url}) { timeline Träwelling -- cgit v1.2.3