diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Open311.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Open311.pm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm index c7e4e5bee..83b9b8202 100644 --- a/perllib/FixMyStreet/App/Controller/Open311.pm +++ b/perllib/FixMyStreet/App/Controller/Open311.pm @@ -231,14 +231,15 @@ sub output_requests : Private { $problem->state( $statusmap{$problem->state} ); + my ($lat, $lon) = map { Utils::truncate_coordinate($_) } $problem->latitude, $problem->longitude; my $request = { 'service_request_id' => $id, 'title' => $problem->title, # Not in Open311 v2 'detail' => $problem->detail, # Not in Open311 v2 'description' => $problem->title .': ' . $problem->detail, - 'lat' => $problem->latitude, - 'long' => $problem->longitude, + 'lat' => $lat, + 'long' => $lon, 'status' => $problem->state, # 'status_notes' => {}, # Zurich has visible unconfirmed reports @@ -307,6 +308,7 @@ sub get_requests : Private { # Only provide access to the published reports my $states = FixMyStreet::DB::Result::Problem->visible_states(); delete $states->{unconfirmed}; + delete $states->{submitted}; my $criteria = { state => [ keys %$states ] }; @@ -409,6 +411,7 @@ sub get_request : Private { my $states = FixMyStreet::DB::Result::Problem->visible_states(); delete $states->{unconfirmed}; + delete $states->{submitted}; my $criteria = { state => [ keys %$states ], id => $id, @@ -419,6 +422,7 @@ sub get_request : Private { sub format_output : Private { my ( $self, $c, $hashref ) = @_; my $format = $c->stash->{format}; + $c->response->header('Access-Control-Allow-Origin' => '*'); if ('json' eq $format) { $c->res->content_type('application/json; charset=utf-8'); $c->res->body( encode_json($hashref) ); @@ -441,11 +445,10 @@ sub is_jurisdiction_id_ok : Private { # Input: DateTime object # Output: 2011-04-23T10:28:55+02:00 -# FIXME Need generic solution to find time zone sub w3date : Private { my $datestr = shift; return unless $datestr; - return DateTime::Format::W3CDTF->format_datetime($datestr); + return DateTime::Format::W3CDTF->format_datetime($datestr->truncate(to => 'second')); } =head1 AUTHOR |