aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Day <steve@mysociety.org>2015-09-30 11:31:56 +0100
committerMatthew Somerville <matthew@mysociety.org>2015-10-01 13:51:05 +0100
commitdaada5411eb2edcd27111abadbd66c9b368c65b0 (patch)
treeb5a1259a6f46a5583fc512673b0618f2f5449df1
parent918908feca5a33f3b070cd03b71383efb3fbe9c8 (diff)
Exclude deleted categories from the all reports page filters
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm2
-rw-r--r--t/app/controller/reports.t23
2 files changed, 24 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index 25d5cd82e..9dc0ad6bc 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -121,7 +121,7 @@ sub ward : Path : Args(2) {
$c->stash->{stats} = $c->cobrand->get_report_stats();
- my @categories = $c->stash->{body}->contacts->search( undef, {
+ my @categories = $c->stash->{body}->contacts->not_deleted->search( undef, {
columns => [ 'category' ],
distinct => 1,
order_by => [ 'category' ],
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t
index ecb43f447..02625fcc7 100644
--- a/t/app/controller/reports.t
+++ b/t/app/controller/reports.t
@@ -216,5 +216,28 @@ subtest "test fiksgatami all reports page" => sub {
}
};
+subtest "test greenwich all reports page" => sub {
+ FixMyStreet::override_config {
+ ALLOWED_COBRANDS => [ 'greenwich' ],
+ MAPIT_URL => 'http://mapit.mysociety.org/'
+ }, sub {
+ my $body = $mech->create_body_ok(2493, 'Royal Borough of Greenwich');
+ my $deleted_contact = $mech->create_contact_ok(
+ body_id => $body->id,
+ category => 'Deleted',
+ email => 'deleted@example.com',
+ deleted => 1
+ );
+ ok $mech->host("greenwich.fixmystreet.com"), 'change host to greenwich';
+ $mech->get_ok('/reports/Royal+Borough+of+Greenwich');
+ # There should not be deleted categories in the list
+ my $category_select = $mech->forms()->[0]->find_input('filter_category');
+ is $category_select->possible_values, 1, 'deleted categories are not shown';
+
+ # Clean up after the test
+ $deleted_contact->delete;
+ }
+};
+
done_testing();