aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand/SeeSomething.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2012-12-20 18:15:07 +0000
committerStruan Donald <struan@exo.org.uk>2012-12-20 18:15:07 +0000
commit0ce436a8796a025924c18ac227b711f2cf2f49f9 (patch)
tree6a48c05136aad1d2856df4156977557087b21b31 /perllib/FixMyStreet/Cobrand/SeeSomething.pm
parent23ffee79fc79d01aec7ac2633a3835dbed419570 (diff)
basic initial stats page for see something
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/SeeSomething.pm')
-rw-r--r--perllib/FixMyStreet/Cobrand/SeeSomething.pm40
1 files changed, 40 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/SeeSomething.pm b/perllib/FixMyStreet/Cobrand/SeeSomething.pm
index 629a5ee50..ca7657176 100644
--- a/perllib/FixMyStreet/Cobrand/SeeSomething.pm
+++ b/perllib/FixMyStreet/Cobrand/SeeSomething.pm
@@ -80,5 +80,45 @@ sub allow_anonymous_reports { 1; }
sub anonymous_account { return { name => 'anon user', email => 'anon@example.com' }; }
+sub admin_pages {
+ my $self = shift;
+
+ return {
+ 'stats' => ['Reports', 0],
+ };
+};
+
+sub admin_stats {
+ my ( $self, $c ) = @_;
+
+ my %filters = ();
+
+ if ( !$c->user_exists || !grep { $_ == $c->user->from_council } @{ $self->council_id } ) {
+ $c->detach( '/page_error_404_not_found' );
+ }
+
+ if ( $c->req->param('category') ) {
+ $filters{category} = $c->req->param('category');
+ }
+
+ if ( $c->req->param('subcategory') ) {
+ $filters{subcategory} = $c->req->param('subcategory');
+ }
+
+ my $p = $c->model('DB::Problem')->search(
+ {
+ confirmed => { not => undef },
+ %filters
+ },
+ {
+ order_by => { -desc=> [ 'confirmed' ] }
+ }
+ );
+
+ $c->stash->{reports} = $p;
+
+ return 1;
+}
+
1;