diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Dashboard.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Dashboard.pm | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm index fbe5a2dc9..f961660c0 100644 --- a/perllib/FixMyStreet/App/Controller/Dashboard.pm +++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm @@ -24,6 +24,8 @@ sub example : Local : Args(0) { my ( $self, $c ) = @_; $c->stash->{template} = 'dashboard/index.html'; + $c->stash->{filter_states} = $c->cobrand->state_groups_inspect; + $c->stash->{children} = {}; for my $i (1..3) { $c->stash->{children}{$i} = { id => $i, name => "Ward $i" }; @@ -93,6 +95,7 @@ sub index : Path : Args(0) { $c->stash->{body} = $body; # Set up the data for the dropdowns + $c->stash->{filter_states} = $c->cobrand->state_groups_inspect; # Just take the first area ID we find my $area_id = $body->body_areas->first->area_id; @@ -145,12 +148,10 @@ sub index : Path : Args(0) { # List of reports underneath summary table $c->stash->{q_state} = $c->get_param('state') || ''; - if ( $c->stash->{q_state} eq 'fixed' ) { + if ( $c->stash->{q_state} eq 'fixed - council' ) { $prob_where->{'me.state'} = [ FixMyStreet::DB::Result::Problem->fixed_states() ]; } elsif ( $c->stash->{q_state} ) { $prob_where->{'me.state'} = $c->stash->{q_state}; - $prob_where->{'me.state'} = { IN => [ 'planned', 'action scheduled' ] } - if $prob_where->{'me.state'} eq 'action scheduled'; } my $params = { %$prob_where, @@ -180,7 +181,7 @@ sub export_as_csv { my ($self, $c, $problems_rs, $body) = @_; require Text::CSV; my $problems = $problems_rs->search( - {}, { prefetch => 'comments' }); + {}, { prefetch => 'comments', order_by => 'me.confirmed' }); my $filename = do { my %where = ( @@ -211,6 +212,9 @@ sub export_as_csv { 'Status', 'Latitude', 'Longitude', 'Nearest Postcode', + 'Ward', + 'Easting', + 'Northing', 'Report URL', ); my @body = ($csv->string); @@ -242,6 +246,13 @@ sub export_as_csv { } } + my $wards = join ', ', + map { $c->stash->{children}->{$_}->{name} } + grep {$c->stash->{children}->{$_} } + split ',', $hashref->{areas}; + + my @local_coords = $report->local_coords; + $csv->combine( @{$hashref}{ 'id', @@ -258,6 +269,9 @@ sub export_as_csv { 'latitude', 'longitude', 'postcode', }, + $wards, + $local_coords[0], + $local_coords[1], (join '', $c->cobrand->base_url_for_report($report), $report->url), ); |