diff options
author | Steven Day <steve@mysociety.org> | 2015-06-29 12:06:11 +0100 |
---|---|---|
committer | Steven Day <steve@mysociety.org> | 2015-06-29 15:48:10 +0100 |
commit | b2c41d9b9ac0444565cdc8b6dbbaeedf759185ba (patch) | |
tree | a2a755e57e92c3991c3681ae13d74347ddf0fb9c /perllib/FixMyStreet/App/Controller/Around.pm | |
parent | 69ed1cda6a315a46e3309dcf3035ad7229931829 (diff) |
Refactor duplicated filter_status code into a single function
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Around.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index c4040af95..5bfe1ada2 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -165,19 +165,7 @@ sub display_location : Private { $c->stash->{all_pins} = $all_pins; my $interval = $all_pins ? undef : $c->cobrand->on_map_default_max_pin_age; - my $states; - $c->stash->{filter_status} = $c->cobrand->on_map_default_status; - my $status = $c->req->param('status') || $c->cobrand->on_map_default_status; - if ( $status eq 'all' ) { - $states = FixMyStreet::DB::Result::Problem->visible_states(); - $c->stash->{filter_status} = 'all'; - } elsif ( $status eq 'open' ) { - $states = FixMyStreet::DB::Result::Problem->open_states(); - $c->stash->{filter_status} = 'open'; - } elsif ( $status eq 'fixed' ) { - $states = FixMyStreet::DB::Result::Problem->fixed_states(); - $c->stash->{filter_status} = 'fixed'; - } + $c->forward( '/reports/stash_report_filter_status' ); # Check the category to filter by, if any, is valid $c->forward('check_and_stash_category'); @@ -185,7 +173,7 @@ sub display_location : Private { # get the map features my ( $on_map_all, $on_map, $around_map, $distance ) = FixMyStreet::Map::map_features( $c, $latitude, $longitude, - $interval, $c->stash->{filter_category}, $states ); + $interval, $c->stash->{filter_category}, $c->stash->{filter_problem_states} ); # copy the found reports to the stash $c->stash->{on_map} = $on_map; |