diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-07 14:01:39 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-14 11:12:12 +0100 |
commit | f604fb2765b2845ddf5c8ba12832348e9d59016c (patch) | |
tree | 2a2f61cac11baf3cec3f854da12bebb8e9684057 /perllib | |
parent | 22226c7893167ebdb86363587cd1635a9b717ece (diff) |
New version of /reports main page.
This is a much broader summary page, plus a body name autocomplete.
This was originally implemented for fixmystreet.com in 8a6a4ccb7.
It also adds '(no longer exists)' in the autocomplete next to
bodies not covering any areas.
You can supply the `--table` argument to `update-all-reports` to
generate the old-style data.
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 21 | ||||
-rw-r--r-- | perllib/FixMyStreet/TestMech.pm | 25 |
2 files changed, 0 insertions, 46 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 024a23872..8f068f0ec 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -384,8 +384,6 @@ sub load_and_group_problems : Private { $c->forward('stash_report_sort', [ $c->cobrand->reports_ordering ]); my $page = $c->get_param('p') || 1; - # NB: If 't' is specified, it will override 'status'. - my $type = $c->get_param('t') || 'all'; my $category = [ $c->get_param_list('filter_category', 1) ]; my $states = $c->stash->{filter_problem_states}; @@ -413,25 +411,6 @@ sub load_and_group_problems : Private { $where->{'me.id'} = { -not_in => $shortlisted_ids }; } - my $not_open = [ FixMyStreet::DB::Result::Problem::fixed_states(), FixMyStreet::DB::Result::Problem::closed_states() ]; - if ( $type eq 'new' ) { - $where->{confirmed} = { '>', \"current_timestamp - INTERVAL '4 week'" }; - $where->{state} = { 'IN', [ FixMyStreet::DB::Result::Problem::open_states() ] }; - } elsif ( $type eq 'older' ) { - $where->{confirmed} = { '<', \"current_timestamp - INTERVAL '4 week'" }; - $where->{lastupdate} = { '>', \"current_timestamp - INTERVAL '8 week'" }; - $where->{state} = { 'IN', [ FixMyStreet::DB::Result::Problem::open_states() ] }; - } elsif ( $type eq 'unknown' ) { - $where->{lastupdate} = { '<', \"current_timestamp - INTERVAL '8 week'" }; - $where->{state} = { 'IN', [ FixMyStreet::DB::Result::Problem::open_states() ] }; - } elsif ( $type eq 'fixed' ) { - $where->{lastupdate} = { '>', \"current_timestamp - INTERVAL '8 week'" }; - $where->{state} = $not_open; - } elsif ( $type eq 'older_fixed' ) { - $where->{lastupdate} = { '<', \"current_timestamp - INTERVAL '8 week'" }; - $where->{state} = $not_open; - } - if (@$category) { $where->{category} = $category; } diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm index 92588a598..aebf7d70c 100644 --- a/perllib/FixMyStreet/TestMech.pm +++ b/perllib/FixMyStreet/TestMech.pm @@ -485,31 +485,6 @@ sub extract_problem_list { return $result->{ problems } || []; } -=head2 extract_report_stats - - $stats = $mech->extract_report_stats - -Returns a hash ref keyed by council name of all the council stats from the all reports -page. Each value is an array ref with the first element being the council name and the -rest being the stats in the order the appear in each row. - -=cut - -sub extract_report_stats { - my $mech = shift; - - my $result = scraper { - process 'tr[align=center]', 'councils[]' => scraper { - process 'td.title a', 'council', 'TEXT', - process 'td', 'stats[]', 'TEXT' - } - }->scrape( $mech->response ); - - my %councils = map { $_->{council} => $_->{stats} } @{ $result->{councils} }; - - return \%councils; -} - =head2 visible_form_values $hashref = $mech->visible_form_values( ); |