Commit 4ba82b51 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Fix invalid geolocation list when less than 5 unique station names are nearby

This issue was introduced in 7c7b5e9f and
caused the client-side javascript code to crash
parent 780cdafc
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -140,12 +140,21 @@ sub geolocation {
		} Travel::Status::DE::IRIS::Stations::get_station_by_location( $lon,
			$lat, 10 );
		@candidates = uniq_by { $_->{name} } @candidates;
		if ( @candidates > 5 ) {
			$self->render(
				json => {
					candidates => [ @candidates[ 0 .. 4 ] ],
				}
			);
		}
		else {
			$self->render(
				json => {
					candidates => [@candidates],
				}
			);
		}
	}
}

sub log_action {