aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Problem.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2017-09-20 15:40:14 +0100
committerStruan Donald <struan@exo.org.uk>2017-09-28 12:33:25 +0100
commit22acc7613cad96477689023a97827c72f9da872d (patch)
treeb46fa0fe72a6a6f14412f776d6c9a350d603df1d /perllib/FixMyStreet/DB/Result/Problem.pm
parent8890888e59ac83e503de4f19a6d84aabaf62aa20 (diff)
show nearest address for report in inspector panel
If we've stored the nearest address then display that at the top of the inspector panel. Fixes mysociety/fixmystreetforcouncils#234
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 0c2dc2aa1..b954a68ab 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -618,6 +618,15 @@ sub meta_line {
return $meta;
}
+sub nearest_address {
+ my $self = shift;
+
+ return '' unless $self->geocode;
+
+ my $address = $self->geocode->{resourceSets}[0]{resources}[0];
+ return $address->{name};
+}
+
sub body {
my ( $problem, $c ) = @_;
my $body;