aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/App/Controller/My.pm25
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm10
2 files changed, 33 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/My.pm b/perllib/FixMyStreet/App/Controller/My.pm
index 79d5c5681..8cb807e09 100644
--- a/perllib/FixMyStreet/App/Controller/My.pm
+++ b/perllib/FixMyStreet/App/Controller/My.pm
@@ -22,7 +22,32 @@ Catalyst Controller.
sub my : Path : Args(0) {
my ( $self, $c ) = @_;
+
$c->detach( '/auth/redirect' ) unless $c->user;
+
+ my $pins = [];
+ my $problems = {};
+ foreach my $problem ( $c->user->problems ) {
+ push @$pins, {
+ latitude => $problem->latitude,
+ longitude => $problem->longitude,
+ colour => $problem->state eq 'fixed' ? 'green' : 'red',
+ id => $problem->id,
+ title => $problem->title,
+ };
+ push @{ $problems->{$problem->state} }, $problem;
+ }
+
+ $c->stash->{problems} = $problems;
+
+ FixMyStreet::Map::display_map(
+ $c,
+ latitude => $pins->[0]{latitude},
+ longitude => $pins->[0]{longitude},
+ pins => $pins,
+ any_zoom => 1,
+ )
+ if @$pins;
}
__PACKAGE__->meta->make_immutable;
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index da23802c3..ff730958a 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -364,8 +364,7 @@ sub meta_line {
return $meta;
}
-# TODO Some/much of this could be moved to the template
-sub duration_string {
+sub body {
my ( $problem, $c ) = @_;
my $body;
if ($problem->external_body) {
@@ -387,6 +386,13 @@ sub duration_string {
} @councils
);
}
+ return $body;
+}
+
+# TODO Some/much of this could be moved to the template
+sub duration_string {
+ my ( $problem, $c ) = @_;
+ my $body = $problem->body( $c );
return sprintf(_('Sent to %s %s later'), $body,
Utils::prettify_duration($problem->whensent_local->epoch - $problem->confirmed_local->epoch, 'minute')
);