aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/App
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/App')
-rw-r--r--perllib/FixMyStreet/App/Controller/Around.pm18
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm5
2 files changed, 13 insertions, 10 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm
index 1e06beef1..370fe7b89 100644
--- a/perllib/FixMyStreet/App/Controller/Around.pm
+++ b/perllib/FixMyStreet/App/Controller/Around.pm
@@ -182,13 +182,17 @@ sub display_location : Private {
# create a list of all the pins
my @pins;
unless ($c->req->param('no_pins')) {
- @pins = map { {
- latitude => $_->{latitude},
- longitude => $_->{longitude},
- colour => $_->{state} eq 'fixed' ? 'green' : 'red',
- id => $_->{id},
- title => $_->{title},
- } } @$on_map_all, @$around_map;
+ @pins = map {
+ # Here we might have a DB::Problem or a DB::Nearby, we always want the problem.
+ my $p = (ref $_ eq 'FixMyStreet::App::Model::DB::Nearby') ? $_->problem : $_;
+ {
+ latitude => $p->latitude,
+ longitude => $p->longitude,
+ colour => $p->state eq 'fixed' ? 'green' : 'red',
+ id => $p->id,
+ title => $p->title,
+ }
+ } @$on_map_all, @$around_map;
}
{ # FIXME - ideally this indented code should be in the templates
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index c64bc9054..17ebc8b0c 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -253,14 +253,13 @@ sub load_problems : Private {
} elsif ($c->stash->{council}) {
$where->{areas} = { 'like', '%' . $c->stash->{council}->{id} . '%' };
}
- my $current_timestamp = Problems::current_timestamp();
my $problems = $c->cobrand->problems->search(
$where,
{
columns => [
'id', 'title', 'detail', 'council', 'state', 'areas',
- { duration => { extract => "epoch from $current_timestamp-lastupdate" } },
- { age => { extract => "epoch from $current_timestamp-confirmed" } },
+ { duration => { extract => "epoch from current_timestamp-lastupdate" } },
+ { age => { extract => "epoch from current_timestamp-confirmed" } },
],
order_by => { -desc => 'id' },
}