aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm27
-rw-r--r--t/cobrand/bromley.t2
2 files changed, 17 insertions, 12 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index 73d5f94bf..8f82817a8 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -132,20 +132,25 @@ sub tweak_all_reports_map {
# A place where this can happen
return unless $c->action eq 'dashboard/heatmap';
- # Bromley only subcategory stuff
+ # Bromley uses an extra attribute question to store 'subcategory',
+ # rather than group/category, but wants this extra question to act
+ # like a subcategory e.g. in the dashboard filter here.
my %subcats = $self->subcategories;
- my $filter = $c->stash->{filter_categories};
- my @new_contacts;
- foreach (@$filter) {
- push @new_contacts, $_;
- foreach (@{$subcats{$_->id}}) {
- push @new_contacts, {
- category => $_->{key},
- category_display => (" " x 4) . $_->{name},
- };
+ my $groups = $c->stash->{category_groups};
+ foreach (@$groups) {
+ my $filter = $_->{categories};
+ my @new_contacts;
+ foreach (@$filter) {
+ push @new_contacts, $_;
+ foreach (@{$subcats{$_->id}}) {
+ push @new_contacts, {
+ category => $_->{key},
+ category_display => (" " x 4) . $_->{name},
+ };
+ }
}
+ $_->{categories} = \@new_contacts;
}
- $c->stash->{filter_categories} = \@new_contacts;
if (!%{$c->stash->{filter_category}}) {
my $cats = $c->user->categories;
diff --git a/t/cobrand/bromley.t b/t/cobrand/bromley.t
index 02ec8750e..71180cd3e 100644
--- a/t/cobrand/bromley.t
+++ b/t/cobrand/bromley.t
@@ -233,7 +233,7 @@ subtest 'check heatmap page' => sub {
FixMyStreet::override_config {
ALLOWED_COBRANDS => 'bromley',
MAPIT_URL => 'http://mapit.uk/',
- COBRAND_FEATURES => { heatmap => { bromley => 1 } },
+ COBRAND_FEATURES => { category_groups => { bromley => 1 }, heatmap => { bromley => 1 } },
}, sub {
$mech->log_in_ok($user->email);
$mech->get_ok('/dashboard/heatmap?end_date=2018-12-31');