summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Travelynx/Controller/Traveling.pm19
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],
+ }
+ );
+ }
}
}