From 13277ad770b6710a9a5536334011d04fcf390919 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Sun, 23 Jul 2023 12:21:37 +0200 Subject: checkout: remove with_related special case travelynx now always calls checkout with the database-provided arr_eva, so the edge case in which it provided a station that is not actually on the route of a train can no longer appear. --- lib/Travelynx/Controller/Api.pm | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'lib/Travelynx') diff --git a/lib/Travelynx/Controller/Api.pm b/lib/Travelynx/Controller/Api.pm index 9685582..d0ebc1b 100755 --- a/lib/Travelynx/Controller/Api.pm +++ b/lib/Travelynx/Controller/Api.pm @@ -277,10 +277,14 @@ sub travel_v1 { ); } if ($to_station) { + + # the user may not have provided the correct to_station, so + # request related stations for checkout. my ( $train2, $error ) = $self->checkout( - station => $to_station, - force => 0, - uid => $uid + station => $to_station, + force => 0, + uid => $uid, + with_related => 1, ); if ($error) { return Mojo::Promise->reject($error); @@ -330,10 +334,13 @@ sub travel_v1 { ); } + # the user may not have provided the correct to_station, so + # request related stations for checkout. my ( $train, $error ) = $self->checkout( - station => $to_station, - force => $payload->{force} ? 1 : 0, - uid => $uid + station => $to_station, + force => $payload->{force} ? 1 : 0, + uid => $uid, + with_related => 1, ); if ($error) { $self->render( -- cgit v1.2.3