aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Problems.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/Problems.pm')
-rw-r--r--perllib/Problems.pm95
1 files changed, 0 insertions, 95 deletions
diff --git a/perllib/Problems.pm b/perllib/Problems.pm
index 5f38a12c4..987820d0c 100644
--- a/perllib/Problems.pm
+++ b/perllib/Problems.pm
@@ -22,101 +22,6 @@ use mySociety::MaPit;
my $site_restriction = '';
my $site_key = 0;
-sub number_comments {
- my $key = "number_comments:$site_key";
- my $result = Memcached::get($key);
- unless ($result) {
- if ($site_restriction) {
- $result = dbh()->selectrow_array("select count(*) from comment, problem
- where comment.problem_id=problem.id and comment.state='confirmed'
- $site_restriction");
- } else {
- $result = dbh()->selectrow_array("select count(*) from comment
- where state='confirmed'");
- }
- Memcached::set($key, $result, 3600);
- }
- return $result;
-}
-
-# Front page recent lists
-
-sub recent_photos {
- my ($num, $lat, $lon, $dist) = @_;
- my $probs;
- if (defined $lat) {
- my $dist2 = $dist; # Create a copy of the variable to stop it being stringified into a locale in the next line!
- my $key = "recent_photos:$site_key:$num:$lat:$lon:$dist2";
- $probs = Memcached::get($key);
- unless ($probs) {
- $probs = mySociety::Locale::in_gb_locale {
- select_all("select id, title
- from problem_find_nearby(?, ?, ?) as nearby, problem
- where nearby.problem_id = problem.id
- and state in ('confirmed', 'fixed') and photo is not null
- $site_restriction
- order by confirmed desc limit $num", $lat, $lon, $dist);
- };
- Memcached::set($key, $probs, 3600);
- }
- } else {
- my $key = "recent_photos:$site_key:$num";
- $probs = Memcached::get($key);
- unless ($probs) {
- $probs = select_all("select id, title from problem
- where state in ('confirmed', 'fixed') and photo is not null
- $site_restriction
- order by confirmed desc limit $num");
- Memcached::set($key, $probs, 3600);
- }
- }
- my $out = '';
- foreach (@$probs) {
- my $title = ent($_->{title});
- $out .= '<a href="/report/' . $_->{id} .
- '"><img border="0" height="100" src="/photo?tn=1;id=' . $_->{id} .
- '" alt="' . $title . '" title="' . $title . '"></a>';
- }
- return $out;
-}
-
-# Fetch an individual problem
-
-# Report functions
-
-=item council_problems WARD COUNCIL
-
-Returns a list of problems for a summary page. If WARD or COUNCIL area ids are given,
-will only return problems for that area. Uses any site restriction defined by the
-cobrand.
-
-=cut
-
-sub council_problems {
- my ($ward, $one_council) = @_;
- my @params;
- my $where_extra = '';
- if ($ward) {
- push @params, $ward;
- $where_extra = "and areas like '%,'||?||',%'";
- } elsif ($one_council) {
- push @params, $one_council;
- $where_extra = "and areas like '%,'||?||',%'";
- }
- my $current_timestamp = current_timestamp();
- my $problems = select_all(
- "select id, title, detail, council, state, areas,
- extract(epoch from $current_timestamp-lastupdate) as duration,
- extract(epoch from $current_timestamp-confirmed) as age
- from problem
- where state in ('confirmed', 'fixed')
- $where_extra
- $site_restriction
- order by id desc
- ", @params);
- return $problems;
-}
-
# Admin view functions
=item problem_search SEARCH