diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/Alert.pm | 2 | ||||
-rw-r--r-- | perllib/Problems.pm | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Alert.pm b/perllib/FixMyStreet/Alert.pm index 9996f03c8..e8532a7d4 100644 --- a/perllib/FixMyStreet/Alert.pm +++ b/perllib/FixMyStreet/Alert.pm @@ -186,7 +186,7 @@ sub email_alerts ($) { $d = int($d*10+0.5)/10; my $testing_email_clause = "and problem.email <> '$testing_email'" if $testing_email; my %data = ( template => $template, data => '', alert_id => $alert->{id}, alert_email => $alert->{email}, lang => $alert->{lang}, cobrand => $alert->{cobrand}, cobrand_data => $alert->{cobrand_data} ); - my $q = "select * from problem_find_nearby(?, ?, ?) as nearby, problem + my $q = "select * from problem_find_nearby_easting_northing(?, ?, ?) as nearby, problem where nearby.problem_id = problem.id and problem.state in ('confirmed', 'fixed') and problem.confirmed >= ? and problem.confirmed >= ms_current_timestamp() - '7 days'::interval and (select whenqueued from alert_sent where alert_sent.alert_id = ? and alert_sent.parameter::integer = problem.id) is null diff --git a/perllib/Problems.pm b/perllib/Problems.pm index 1556b7724..263d58bc9 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -94,7 +94,7 @@ sub recent_photos { $probs = Memcached::get($key); unless ($probs) { $probs = select_all("select id, title - from problem_find_nearby(?, ?, ?) as nearby, problem + from problem_find_nearby_easting_northing(?, ?, ?) as nearby, problem where nearby.problem_id = problem.id and state in ('confirmed', 'fixed') and photo is not null $site_restriction @@ -193,7 +193,7 @@ sub nearby { mySociety::Locale::in_gb_locale { select_all( "select id, title, easting, northing, distance, state, extract(epoch from confirmed) as time - from problem_find_nearby(?, ?, $dist) as nearby, problem + from problem_find_nearby_easting_northing(?, ?, $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 . ')' : '') . " @@ -206,7 +206,7 @@ sub fixed_nearby { my ($dist, $mid_e, $mid_n) = @_; mySociety::Locale::in_gb_locale { select_all( "select id, title, easting, northing, distance - from problem_find_nearby(?, ?, $dist) as nearby, problem + from problem_find_nearby_easting_northing(?, ?, $dist) as nearby, problem where nearby.problem_id = problem.id and state='fixed' $site_restriction order by lastupdate desc", $mid_e, $mid_n); |