diff options
author | Struan Donald <struan@exo.org.uk> | 2017-11-30 15:19:39 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-12-15 17:35:53 +0000 |
commit | fb75d4f912c504b42d11f2c8f32b5dcff2b348b6 (patch) | |
tree | 794942f1aa5fff74c3dd40439764c1ad86456692 /perllib/FixMyStreet/App/Controller/Dashboard.pm | |
parent | f8f4d505ee63e3e8eb83576b3e3ce64c2b35c322 (diff) |
[fixmystreet.com] Marketing page, filterable stats
Uses the dashboard stats code to display a rough table of stats which
can be used as the basis for a chart later
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Dashboard.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Dashboard.pm | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm index 5fe473c54..cff4c8dab 100644 --- a/perllib/FixMyStreet/App/Controller/Dashboard.pm +++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm @@ -175,15 +175,15 @@ sub generate_data { $state_map->{$_} = 'closed' foreach FixMyStreet::DB::Result::Problem->closed_states; $state_map->{$_} = 'fixed' foreach FixMyStreet::DB::Result::Problem->fixed_states; - $self->generate_grouped_data($c); + $c->forward('generate_grouped_data'); $self->generate_summary_figures($c); } -sub generate_grouped_data { +sub generate_grouped_data : Private { my ($self, $c) = @_; my $state_map = $c->stash->{state_map}; - my $group_by = $c->get_param('group_by') || ''; + my $group_by = $c->get_param('group_by') || $c->stash->{group_by_default} || ''; my (%grouped, @groups, %totals); if ($group_by eq 'category') { %grouped = map { $_->category => {} } @{$c->stash->{contacts}}; @@ -197,6 +197,8 @@ sub generate_grouped_data { ); } elsif ($group_by eq 'device+site') { @groups = qw/cobrand service/; + } elsif ($group_by eq 'device') { + @groups = qw/service/; } else { $group_by = 'category+state'; @groups = qw/category state/; |