diff options
author | Matthew Somerville <matthew@mysociety.org> | 2019-07-11 17:50:52 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2019-07-12 17:22:39 +0100 |
commit | 056118883562df7f7cf4d917ffbac0a6f1f1faef (patch) | |
tree | 2570ec7ff966a7ca82c6fc38e5991844bd0144a7 /perllib/FixMyStreet/Cobrand/Bexley.pm | |
parent | 58fe7b2c649c29b09338c8ea76314aef29385bf5 (diff) |
[Bexley] Include subcategory in dashboard export.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/Bexley.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bexley.pm | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm index 1f16b817e..26470617a 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley.pm @@ -131,4 +131,31 @@ sub open311_post_send { $sender->send($row, $h); } +sub dashboard_export_problems_add_columns { + my $self = shift; + my $c = $self->{c}; + + my %groups; + if ($c->stash->{body}) { + %groups = FixMyStreet::DB->resultset('Contact')->active->search({ + body_id => $c->stash->{body}->id, + })->group_lookup; + } + + splice @{$c->stash->{csv}->{headers}}, 5, 0, 'Subcategory'; + splice @{$c->stash->{csv}->{columns}}, 5, 0, 'subcategory'; + + $c->stash->{csv}->{extra_data} = sub { + my $report = shift; + + if ($groups{$report->category}) { + return { + category => $groups{$report->category}, + subcategory => $report->category, + }; + } + return {}; + }; +} + 1; |