summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Controller
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-11-01 18:44:00 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-11-01 18:44:00 +0100
commit6364751eb13ed18111e69a06185657d64bdea5ac (patch)
tree74fc90ed2515996cb7f5db062a078836b72542c9 /lib/Travelynx/Controller
parent0b1de4136647190003b2362fdd6a89fec53eb9e4 (diff)
HAFAS: Use locationSearch rather than similar_stops_p
locationSearch uses mgate.exe, just like the regular departure board. similar_stops_p relies on ajax-getstop.exe which may become unavailable sooner rather than later.
Diffstat (limited to 'lib/Travelynx/Controller')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm
index 0a035b0..08e7fa4 100755
--- a/lib/Travelynx/Controller/Traveling.pm
+++ b/lib/Travelynx/Controller/Traveling.pm
@@ -1105,23 +1105,20 @@ sub station {
}
elsif ( $use_hafas and $status and $status->errcode eq 'LOCATION' )
{
- $status->similar_stops_p->then(
+ $self->hafas->search_location_p( query => $station )->then(
sub {
- my @suggestions = @_;
+ my ($hafas2) = @_;
+ my @suggestions = $hafas2->results;
if ( @suggestions == 1 ) {
$self->redirect_to(
- '/s/' . $suggestions[0]->{id} . '?hafas=1' );
+ '/s/' . $suggestions[0]->eva . '?hafas=1' );
}
else {
$self->render(
'disambiguation',
suggestions => [
- map {
- {
- name => $_->{name},
- eva => $_->{id}
- }
- } @suggestions
+ map { { name => $_->name, eva => $_->eva } }
+ @suggestions
],
status => 300,
);
@@ -1133,7 +1130,7 @@ sub station {
$self->render(
'exception',
exception =>
- "StopFinder threw '$err2' when handling '$err'",
+"locationSearch threw '$err2' when handling '$err'",
status => 502
);
}