diff options
-rwxr-xr-x | lib/Travelynx/Controller/Traveling.pm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Travelynx/Controller/Traveling.pm b/lib/Travelynx/Controller/Traveling.pm index eebe27a..3fea24b 100755 --- a/lib/Travelynx/Controller/Traveling.pm +++ b/lib/Travelynx/Controller/Traveling.pm @@ -140,11 +140,20 @@ sub geolocation { } Travel::Status::DE::IRIS::Stations::get_station_by_location( $lon, $lat, 10 ); @candidates = uniq_by { $_->{name} } @candidates; - $self->render( - json => { - candidates => [ @candidates[ 0 .. 4 ] ], - } - ); + if ( @candidates > 5 ) { + $self->render( + json => { + candidates => [ @candidates[ 0 .. 4 ] ], + } + ); + } + else { + $self->render( + json => { + candidates => [@candidates], + } + ); + } } } |