summaryrefslogtreecommitdiff
path: root/index.pl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-10-03 12:32:52 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-10-03 12:32:52 +0200
commita96e2d5682e91014b4e071d80b74bcd1ae674b9a (patch)
treec4a6e7d9bdde5be449d93ba0a5cb9ac0d02fd186 /index.pl
parent429d5b52623bed166808436fa0acf51e8a80e0ad (diff)
parentc3395f3e7a17c8455742f2b9d505342a0f5e21ac (diff)
Merge branch 'master' of lastlight:var/git_root/vrr-fakedisplay
Diffstat (limited to 'index.pl')
-rw-r--r--index.pl27
1 files changed, 18 insertions, 9 deletions
diff --git a/index.pl b/index.pl
index 2189d4d..687804d 100644
--- a/index.pl
+++ b/index.pl
@@ -128,6 +128,10 @@ sub get_results {
if ( $status->can('identified_data') ) {
( $data->{id_name}, $data->{id_stop} ) = $status->identified_data;
}
+ if ( $status->errstr and $status->can('name_candidates') ) {
+ $data->{name_candidates} = [ $status->name_candidates ];
+ $data->{place_candidates} = [ $status->place_candidates ];
+ }
$cache->freeze( $sstr, $data );
}
@@ -142,11 +146,11 @@ sub handle_request {
my $no_lines = $self->param('no_lines');
my $frontend = $self->param('frontend') // 'png';
my $backend = $self->param('backend') // $default{backend};
- my $errstr;
+ my $data;
if ( ( $city and $stop ) or ( $backend eq 'aseag' and $stop ) ) {
- $errstr = get_results( $self->param('backend') // $default{backend},
- $city, $stop )->{errstr};
+ $data = get_results( $self->param('backend') // $default{backend},
+ $city, $stop );
}
if ( not $no_lines or $no_lines < 1 or $no_lines > 40 ) {
@@ -162,12 +166,14 @@ sub handle_request {
$self->render(
'main',
- city => $city,
- stop => $stop,
- version => $VERSION,
- frontend => $frontend,
- errstr => $errstr,
- title => $stop
+ city => $city,
+ stop => $stop,
+ version => $VERSION,
+ frontend => $frontend,
+ errstr => $data->{errstr},
+ name_candidates => $data->{name_candidates},
+ place_candidates => $data->{place_candidates},
+ title => $stop
? "departures for ${city} ${stop}"
: "vrr-infoscreen ${VERSION}",
);
@@ -540,6 +546,9 @@ helper 'hafas_service_list' => sub {
return @hafas_services;
};
+helper 'handle_no_results' => sub {
+};
+
get '/_redirect' => sub {
my $self = shift;
my $city = $self->param('city') // q{};