diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index ca29594..7599dd0 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -3,6 +3,7 @@ use Mojo::Base 'Mojolicious::Controller'; use DateTime; use DateTime::Format::Strptime; +use List::UtilsBy qw(uniq_by); use Travel::Status::DE::IRIS::Stations; sub homepage { @@ -137,10 +138,11 @@ sub geolocation { distance => $_->[1], } } Travel::Status::DE::IRIS::Stations::get_station_by_location( $lon, - $lat, 5 ); + $lat, 10 ); + @candidates = uniq_by { $_->{name} } @candidates; $self->render( json => { - candidates => [@candidates], + candidates => [ @candidates[ 0 .. 4 ] ], } ); } |