From 2835ee9d82d508e32720138702ca3879a41c19db Mon Sep 17 00:00:00 2001 From: Matthew Somerville Date: Tue, 6 Sep 2016 16:07:30 +0100 Subject: Add manage screen for editing priority/category. This is a cut-down version of the full inspect screen. We truncate the co-ordinates just in case (they should be anyway but e.g. the test report isn't). --- perllib/FixMyStreet/App/Controller/Admin.pm | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm') diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index c853827d0..1713c4ff9 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -859,14 +859,11 @@ $problem->bodies_str. sub report_edit_location : Private { my ($self, $c, $problem) = @_; - return 1 unless $c->forward('/report/new/determine_location'); - - if ( $c->stash->{latitude} != $problem->latitude || $c->stash->{longitude} != $problem->longitude ) { - delete $c->stash->{prefetched_all_areas}; - delete $c->stash->{all_areas}; - delete $c->stash->{fetch_all_areas}; - delete $c->stash->{all_areas_mapit}; - $c->forward('/council/load_and_check_areas'); + return 1 unless $c->forward('/location/determine_location_from_coords'); + + my ($lat, $lon) = map { Utils::truncate_coordinate($_) } $problem->latitude, $problem->longitude; + if ( $c->stash->{latitude} != $lat || $c->stash->{longitude} != $lon ) { + $c->forward('/council/load_and_check_areas', []); $c->forward('/report/new/setup_categories_and_bodies'); my %allowed_bodies = map { $_ => 1 } @{$problem->bodies_str_ids}; my @new_bodies = @{$c->stash->{bodies_to_list}}; @@ -885,8 +882,8 @@ sub categories_for_point : Private { # We have a report, stash its location $c->forward('/report/new/determine_location_from_report'); # Look up the areas for this location - $c->stash->{prefetched_all_areas} = [ grep { $_ } split ',', $c->stash->{report}->areas ]; - $c->forward('/around/check_location_is_acceptable'); + my $prefetched_all_areas = [ grep { $_ } split ',', $c->stash->{report}->areas ]; + $c->forward('/around/check_location_is_acceptable', [ $prefetched_all_areas ]); # As with a new report, fetch the bodies/categories $c->forward('/report/new/setup_categories_and_bodies'); -- cgit v1.2.3