Skip to content

Commit

Permalink
Store Gaze result to prevent subsequent call.
Browse files Browse the repository at this point in the history
For some reason as part of 66f2160, I removed the stashing of the Gaze
call (made as part of nearby report looking up) to save it being called
again by the map zoom code.
  • Loading branch information
dracos committed Feb 19, 2021
1 parent b4b77fc commit d840033
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion perllib/FixMyStreet/App/Controller/Around.pm
Expand Up @@ -280,7 +280,7 @@ sub map_features : Private {
# Allow the cobrand to add in any additional query parameters
my $extra_params = $c->cobrand->call_hook('display_location_extra_params');

my ( $on_map, $nearby ) =
my ( $on_map, $nearby, $distance ) =
FixMyStreet::Map::map_features(
$c, %$extra,
categories => [ keys %{$c->stash->{filter_category}} ],
Expand All @@ -306,6 +306,7 @@ sub map_features : Private {
$c->stash->{extra_pins} = $extra_pins;
$c->stash->{on_map} = $on_map;
$c->stash->{around_map} = $nearby;
$c->stash->{distance} = $distance if $distance; # So Gaze not called again
}

=head2 ajax
Expand Down
2 changes: 1 addition & 1 deletion perllib/FixMyStreet/Map.pm
Expand Up @@ -118,7 +118,7 @@ sub map_features {
$nearby = $c->model('DB::Nearby')->nearby($c, %p);
}

return ( $on_map, $nearby );
return ( $on_map, $nearby, $p{distance} );
}

sub click_to_wgs84 {
Expand Down
3 changes: 2 additions & 1 deletion t/map/tilma/original.t
Expand Up @@ -93,10 +93,11 @@ for my $test (
$report->update;
$c->stash->{report_age_field} = 'lastupdate';

my ($on_map, $nearby) = FixMyStreet::Map::map_features($c, bbox => "0,0,0,0");
my ($on_map, $nearby, $dist) = FixMyStreet::Map::map_features($c, bbox => "0,0,0,0");

ok $on_map;
ok $nearby;
ok $dist;

my $id = $report->id;
my $colour = $test->{colour};
Expand Down

0 comments on commit d840033

Please sign in to comment.