summaryrefslogtreecommitdiff
path: root/lib/DBInfoscreen/Controller/Stationboard.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2023-02-06 19:19:49 +0100
committerDaniel Friesel <derf@finalrewind.org>2023-02-06 19:19:49 +0100
commitc0a7d8a062518292c798fe6d5f0e6b0d21fee7d0 (patch)
tree85ac85f2cad473344e316f29d4253633dba20671 /lib/DBInfoscreen/Controller/Stationboard.pm
parentb13972296f64499debf19c309d3144f406c397c3 (diff)
hafas backend: show shortest station name in title4.15.6
Diffstat (limited to 'lib/DBInfoscreen/Controller/Stationboard.pm')
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index aa301fb..e708305 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -472,6 +472,12 @@ sub handle_request {
( $status->station ? $status->station->{name} : $station ),
};
+ if ( $status->station and $status->station->{names} ) {
+ $data->{station_name}
+ = List::Util::reduce { length($a) < length($b) ? $a : $b }
+ @{ $status->station->{names} };
+ }
+
if ( not @{ $data->{results} } and $template eq 'json' ) {
$self->handle_no_results_json( $station, $data, $api_version );
return;