From 6ea954c9634912f499c2f1c2b3356d491e40f747 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 16 Jun 2025 20:01:07 +0200 Subject: show load/occupancy for EFA departures and trips, if available --- lib/Travelynx.pm | 26 ++++++++++++++++++++++++++ templates/_departures_efa.html.ep | 3 +++ templates/_show_load_icons.html.ep | 4 ++++ 3 files changed, 33 insertions(+) diff --git a/lib/Travelynx.pm b/lib/Travelynx.pm index 3d892ec..7c8dc19 100755 --- a/lib/Travelynx.pm +++ b/lib/Travelynx.pm @@ -446,6 +446,32 @@ sub startup { } ); + $self->helper( + 'efa_load_icon' => sub { + my ( $self, $occupancy ) = @_; + + my @symbols + = ( + qw(help_outline person_outline people priority_high not_interested) + ); + + if ( $occupancy eq 'MANY_SEATS' ) { + $occupancy = 1; + } + elsif ( $occupancy eq 'FEW_SEATS' ) { + $occupancy = 2; + } + elsif ( $occupancy eq 'STANDING_ONLY' ) { + $occupancy = 3; + } + elsif ( $occupancy eq 'FULL' ) { + $occupancy = 4; + } + + return $symbols[$occupancy] // 'help_outline'; + } + ); + $self->helper( 'load_icon' => sub { my ( $self, $load ) = @_; diff --git a/templates/_departures_efa.html.ep b/templates/_departures_efa.html.ep index 6aec1c8..0abd887 100644 --- a/templates/_departures_efa.html.ep +++ b/templates/_departures_efa.html.ep @@ -47,6 +47,9 @@ <%= $checkin->{followee_name} %> → <%= $checkin->{arr_name} // '???' %> % } + % if ($result->occupancy) { + + % } % } diff --git a/templates/_show_load_icons.html.ep b/templates/_show_load_icons.html.ep index e69dab5..21093b9 100644 --- a/templates/_show_load_icons.html.ep +++ b/templates/_show_load_icons.html.ep @@ -5,3 +5,7 @@ % } % } +% elsif ($station->[2]{efa_load}) { + % my ($icon) = efa_load_icon($station->[2]{efa_load}); + +% } -- cgit v1.2.3