summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/DBInfoscreen.pm20
-rw-r--r--lib/DBInfoscreen/Controller/Stationboard.pm17
-rw-r--r--templates/single.html.ep2
3 files changed, 34 insertions, 5 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm
index aad1290..b062c9d 100644
--- a/lib/DBInfoscreen.pm
+++ b/lib/DBInfoscreen.pm
@@ -245,6 +245,26 @@ sub startup {
}
);
+ $self->helper(
+ 'numeric_platform_part' => sub {
+ my ( $self, $platform ) = @_;
+
+ if ( not defined $platform ) {
+ return 0;
+ }
+
+ if ( $platform =~ m{ ^ \d+ $ }x ) {
+ return $platform;
+ }
+
+ if ( $platform =~ m{ (\d+) }x ) {
+ return $1;
+ }
+
+ return 0;
+ }
+ );
+
my $r = $self->routes;
$r->get('/_redirect')->to('static#redirect');
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm
index 95aa08c..5acd616 100644
--- a/lib/DBInfoscreen/Controller/Stationboard.pm
+++ b/lib/DBInfoscreen/Controller/Stationboard.pm
@@ -519,15 +519,24 @@ sub handle_request {
if ( $template eq 'single' ) {
if ( not @platforms ) {
for my $result (@results) {
- if ( not( $result->platform ~~ \@platforms ) ) {
- push( @platforms, $result->platform );
+ if (
+ not( $self->numeric_platform_part( $result->platform ) ~~
+ \@platforms )
+ )
+ {
+ push( @platforms,
+ $self->numeric_platform_part( $result->platform ) );
}
}
@platforms = sort { $a <=> $b } @platforms;
}
my %pcnt;
- @results = grep { $pcnt{ $_->platform }++ < 1 } @results;
- @results = sort { $a->platform <=> $b->platform } @results;
+ @results
+ = grep { $pcnt{ $self->numeric_platform_part( $_->platform ) }++ < 1 }
+ @results;
+ @results = map { $_->[1] }
+ sort { $a->[0] <=> $b->[0] }
+ map { [ $self->numeric_platform_part( $_->platform ), $_ ] } @results;
}
if ( $backend eq 'iris' and $show_realtime ) {
diff --git a/templates/single.html.ep b/templates/single.html.ep
index a4e370c..681dfee 100644
--- a/templates/single.html.ep
+++ b/templates/single.html.ep
@@ -6,7 +6,7 @@
% $i++;
<div class="display">
<div class="platform">
-%= $departure->{platform}
+%= numeric_platform_part($departure->{platform})
</div>
<div class="time">
%= $departure->{time}