diff options
Diffstat (limited to 'perllib/Problems.pm')
-rw-r--r-- | perllib/Problems.pm | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/perllib/Problems.pm b/perllib/Problems.pm index 5f38a12c4..1f3eaf7b9 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -39,84 +39,6 @@ sub number_comments { 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 |