diff options
author | Struan Donald <struan@exo.org.uk> | 2017-09-04 17:04:49 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2017-09-04 17:47:33 +0100 |
commit | 4c0328bbe43b5cdf0ca9660505220d093a0cebe0 (patch) | |
tree | 53d57c44069f277132bdc4b065210fe8b3b07381 /perllib | |
parent | 3ce2864f19b6d6ced7d5181a1feadf2d97fe3501 (diff) |
include ward in dashboard csv export
Adds a Ward column to the council dashboard CSV export with the name of
the ward.
Fixes mysociety/fixmystreetforcouncils#220
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Dashboard.pm | 7 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm index f3989e760..dbbd57623 100644 --- a/perllib/FixMyStreet/App/Controller/Dashboard.pm +++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm @@ -212,6 +212,7 @@ sub export_as_csv { 'Status', 'Latitude', 'Longitude', 'Nearest Postcode', + 'Ward', 'Report URL', ); my @body = ($csv->string); @@ -243,6 +244,11 @@ sub export_as_csv { } } + my $wards = join ', ', + map { $c->stash->{children}->{$_}->{name} } + grep {$c->stash->{children}->{$_} } + split ',', $hashref->{areas}; + $csv->combine( @{$hashref}{ 'id', @@ -259,6 +265,7 @@ sub export_as_csv { 'latitude', 'longitude', 'postcode', }, + $wards, (join '', $c->cobrand->base_url_for_report($report), $report->url), ); diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 77190679b..3b622b561 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -861,6 +861,7 @@ sub as_hashref { latitude => $self->latitude, longitude => $self->longitude, postcode => $self->postcode, + areas => $self->areas, state => $self->state, state_t => _( $self->state ), used_map => $self->used_map, |