aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Problems.pm
diff options
context:
space:
mode:
authorLouise Crow <louise@mysociety.org>2010-05-27 10:06:28 +0100
committerLouise Crow <louise@mysociety.org>2010-05-27 10:06:28 +0100
commit1c42f9fe11b7285ee4ea356d757aa549c7a44522 (patch)
treebeca30740336ebcf1c061807f12c5008e9873ee7 /perllib/Problems.pm
parent7b11e3d67f39f1c4049acaff9ef800a355d7f984 (diff)
parent77beaf0c40637c56edee91a4e2e8966783ee8a10 (diff)
Merge branch 'master' of ssh://louise@git.mysociety.org/data/git/public/fixmystreet into cities_release_1
Diffstat (limited to 'perllib/Problems.pm')
-rw-r--r--perllib/Problems.pm10
1 files changed, 7 insertions, 3 deletions
diff --git a/perllib/Problems.pm b/perllib/Problems.pm
index 69293e162..aad6c0716 100644
--- a/perllib/Problems.pm
+++ b/perllib/Problems.pm
@@ -209,7 +209,7 @@ sub fixed_nearby {
sub fetch_problem {
my $id = shift;
- dbh()->selectrow_hashref(
+ my $p = dbh()->selectrow_hashref(
"select id, easting, northing, council, category, title, detail, photo,
used_map, name, anonymous, extract(epoch from confirmed) as time,
state, extract(epoch from whensent-confirmed) as whensent,
@@ -218,7 +218,10 @@ sub fetch_problem {
from problem where id=? and state in ('confirmed','fixed', 'hidden')
$site_restriction", {}, $id
);
+ $p->{service} =~ s/_/ /g;
+ return $p;
}
+
# API functions
sub problems_matching_criteria {
@@ -301,10 +304,11 @@ sub council_problems {
push @params, $one_council;
$where_extra = "and areas like '%,'||?||',%'";
}
+ my $current_time = dbh()->selectrow_array('select ms_current_timestamp()');
my $problems = select_all(
"select id, title, detail, council, state, areas,
- extract(epoch from ms_current_timestamp()-lastupdate) as duration,
- extract(epoch from ms_current_timestamp()-confirmed) as age
+ extract(epoch from '$current_time'-lastupdate) as duration,
+ extract(epoch from '$current_time'-confirmed) as age
from problem
where state in ('confirmed', 'fixed')
$where_extra