mirror of
https://github.com/derf/travelynx
synced 2024-12-04 18:29:11 +00:00
sort HAFAS/IRIS stations by distance
This commit is contained in:
parent
3eda3beeae
commit
8f747fff91
1 changed files with 6 additions and 3 deletions
|
@ -593,12 +593,15 @@ sub geolocation {
|
|||
hafas => 1
|
||||
}
|
||||
} $hafas->results;
|
||||
if ( @hafas > 5 ) {
|
||||
@hafas = @hafas[ 0 .. 4 ];
|
||||
if ( @hafas > 10 ) {
|
||||
@hafas = @hafas[ 0 .. 9 ];
|
||||
}
|
||||
my @results = map { $_->[0] }
|
||||
sort { $a->[1] <=> $b->[1] }
|
||||
map { [ $_, $_->{distance} ] } ( @iris, @hafas );
|
||||
$self->render(
|
||||
json => {
|
||||
candidates => [ @iris, @hafas ],
|
||||
candidates => [@results],
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue