diff options
author | Matthew Somerville <matthew@mysociety.org> | 2011-06-09 00:59:23 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2011-06-09 00:59:23 +0100 |
commit | ba0bd42476b93908529f63bb8b71135ebf7a86ca (patch) | |
tree | d9376ff3c5b8b6f75e3ab92c7ec5d1cbc99f553f /perllib/FixMyStreet/Map.pm | |
parent | 8756c80504ceb6275f637c75fdcf1a047970d6ff (diff) |
Move the tricky nearby DB call to its own Result/ResultSet, and move more functions.
Diffstat (limited to 'perllib/FixMyStreet/Map.pm')
-rw-r--r-- | perllib/FixMyStreet/Map.pm | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/Map.pm b/perllib/FixMyStreet/Map.pm index 6b41c8d0d..6a5a82fa9 100644 --- a/perllib/FixMyStreet/Map.pm +++ b/perllib/FixMyStreet/Map.pm @@ -80,8 +80,8 @@ sub map_features { my $around_limit = $c->cobrand->on_map_list_limit || undef; my @around_args = ( $min_lat, $max_lat, $min_lon, $max_lon, $interval ); - my $around_map_list = Problems::around_map( @around_args, $around_limit ); - my $around_map = Problems::around_map( @around_args, undef ); + my $around_map_list = $c->cobrand->problems->around_map( @around_args, $around_limit ); + my $around_map = $c->cobrand->problems->around_map( @around_args, undef ); my $dist; mySociety::Locale::in_gb_locale { @@ -92,9 +92,10 @@ sub map_features { $dist = int( $dist * 10 + 0.5 ) / 10; my $limit = 20; - my @ids = map { $_->{id} } @$around_map_list; - my $nearby = Problems::nearby( $dist, join( ',', @ids ), - $limit, $lat, $lon, $interval ); + my @ids = map { $_->id } @$around_map_list; + my $nearby = $c->model('DB::Nearby')->nearby( + $c, $dist, \@ids, $limit, $lat, $lon, $interval + ); return ( $around_map, $around_map_list, $nearby, $dist ); } |