aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Map.pm5
-rw-r--r--perllib/Problems.pm16
2 files changed, 11 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/Map.pm b/perllib/FixMyStreet/Map.pm
index 12ecf78fe..bfb68f73c 100644
--- a/perllib/FixMyStreet/Map.pm
+++ b/perllib/FixMyStreet/Map.pm
@@ -66,16 +66,17 @@ sub map_features {
$around_map = $around_map_list = Problems::around_map($min_e, $max_e, $min_n, $max_n, $interval, undef);
}
+ my ($lat, $lon) = mySociety::GeoUtil::national_grid_to_wgs84($mid_e, $mid_n, 'G');
+
my $dist;
mySociety::Locale::in_gb_locale {
- my ($lat, $lon) = mySociety::GeoUtil::national_grid_to_wgs84($mid_e, $mid_n, 'G');
$dist = mySociety::Gaze::get_radius_containing_population($lat, $lon, 200000);
};
$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, $mid_e, $mid_n, $interval);
+ my $nearby = Problems::nearby($dist, join(',', @ids), $limit, $mid_lat, $mid_lon, $interval);
return ($around_map, $around_map_list, $nearby, $dist);
}
diff --git a/perllib/Problems.pm b/perllib/Problems.pm
index c81c72fbd..7a4c4974e 100644
--- a/perllib/Problems.pm
+++ b/perllib/Problems.pm
@@ -189,27 +189,27 @@ sub around_map {
}
sub nearby {
- my ($dist, $ids, $limit, $mid_e, $mid_n, $interval) = @_;
+ my ($dist, $ids, $limit, $mid_lat, $mid_lon, $interval) = @_;
mySociety::Locale::in_gb_locale { select_all(
- "select id, title, easting, northing, distance, state,
+ "select id, title, latitude, longitude, distance, state,
extract(epoch from confirmed) as time
- from problem_find_nearby_easting_northing(?, ?, $dist) as nearby, problem
+ from problem_find_nearby(?, ?, $dist) as nearby, problem
where nearby.problem_id = problem.id " .
($interval ? " and ms_current_timestamp()-lastupdate < '$interval'::interval" : '') .
" and state in ('confirmed', 'fixed')" . ($ids ? ' and id not in (' . $ids . ')' : '') . "
$site_restriction
- order by distance, created desc limit $limit", $mid_e, $mid_n);
+ order by distance, created desc limit $limit", $mid_lat, $mid_lon);
}
}
sub fixed_nearby {
- my ($dist, $mid_e, $mid_n) = @_;
+ my ($dist, $mid_lat, $mid_lon) = @_;
mySociety::Locale::in_gb_locale { select_all(
- "select id, title, easting, northing, distance
- from problem_find_nearby_easting_northing(?, ?, $dist) as nearby, problem
+ "select id, title, latitude, longitude, distance
+ from problem_find_nearby(?, ?, $dist) as nearby, problem
where nearby.problem_id = problem.id and state='fixed'
$site_restriction
- order by lastupdate desc", $mid_e, $mid_n);
+ order by lastupdate desc", $mid_lat, $mid_lon);
}
}