diff options
author | Struan Donald <struan@exo.org.uk> | 2011-07-26 16:57:08 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-07-26 16:57:08 +0100 |
commit | 54066cd1387643dd6c6cb3040c520bee66881fd7 (patch) | |
tree | eda84b3f347220ed12de3aa690116148287891bd /perllib/FixMyStreet/App/Controller/Admin.pm | |
parent | 8146bad18eeaab658871dd28eb38199a5d068395 (diff) | |
parent | 198fcef62892fe0b2fbb3ea8a080fca87843445e (diff) |
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet into new_statuses
Conflicts:
perllib/FixMyStreet/App/Controller/Admin.pm
perllib/FixMyStreet/App/Controller/JSON.pm
perllib/FixMyStreet/Map/Tilma/Original.pm
web/css/core.css
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index f38181be6..63d892fc4 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -62,6 +62,7 @@ sub index : Path : Args(0) { $c->stash->{problems} = \%prob_counts; $c->stash->{total_problems_live} += $prob_counts{$_} for ( FixMyStreet::DB::Result::Problem->visible_states() ); + $c->stash->{total_problems_users} = $c->cobrand->problems->unique_users; my $comments = $c->model('DB::Comment')->summary_count( $site_restriction ); @@ -108,6 +109,8 @@ sub index : Path : Args(0) { : _('n/a'); $c->stash->{questionnaires} = \%questionnaire_counts; + $c->stash->{categories} = $c->cobrand->problems->categories_summary(); + return 1; } @@ -120,6 +123,7 @@ sub timeline : Path( 'timeline' ) : Args(0) { my %time; $c->model('DB')->schema->storage->sql_maker->quote_char( '"' ); + $c->model('DB')->schema->storage->sql_maker->name_sep( '.' ); my $probs = $c->cobrand->problems->timeline; @@ -172,15 +176,22 @@ sub questionnaire : Path('questionnaire') : Args(0) { my %questionnaire_counts = map { $_->get_column( 'reported' ) => $_->get_column( 'questionnaire_count' ) } $questionnaires->all; - $questionnaire_counts{1} ||= 0; $questionnaire_counts{0} ||= 0; - $questionnaire_counts{total} = $questionnaire_counts{0} + $questionnaire_counts{1}; - $c->stash->{reported_pc} = ( 100 * $questionnaire_counts{1} ) / $questionnaire_counts{total}; - $c->stash->{not_reported_pc} = ( 100 * $questionnaire_counts{0} ) / $questionnaire_counts{total}; $c->stash->{questionnaires} = \%questionnaire_counts; + $c->stash->{state_changes_count} = $c->model('DB::Questionnaire')->search( + { whenanswered => \'is not null' } + )->count; + $c->stash->{state_changes} = $c->model('DB::Questionnaire')->search( + { whenanswered => \'is not null' }, + { + group_by => [ 'old_state', 'new_state' ], + columns => [ 'old_state', 'new_state', { c => { count => 'id' } } ], + }, + ); + return 1; } @@ -419,6 +430,7 @@ sub search_reports : Path('search_reports') { # makes PostgreSQL unhappy elsewhere so we only want to do # it for this query and then switch it off afterwards. $c->model('DB')->schema->storage->sql_maker->quote_char( '"' ); + $c->model('DB')->schema->storage->sql_maker->name_sep( '.' ); my $problems = $c->cobrand->problems->search( { |