Unverified Commit 053ae77d authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

hafas: if there is just one candidate: redirect to it

parent bb8530ef
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -46,6 +46,12 @@ sub handle_no_results {
			sub {
				my (@candidates) = @_;
				@candidates = map { [ $_->{name}, $_->{id} ] } @candidates;
				if ( @candidates == 1 ) {
					my $s      = $candidates[0][0];
					my $params = $self->req->params->to_string;
					$self->redirect_to("/${s}?${params}");
					return;
				}
				for my $candidate (@candidates) {
					$candidate->[0] =~ s{[&]#x0028;}{(}g;
					$candidate->[0] =~ s{[&]#x0029;}{)}g;