diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Alert.pm | 8 | ||||
-rw-r--r-- | t/app/controller/admin.t | 4 | ||||
-rw-r--r-- | templates/web/base/status/stats.html | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 686d23aa1..693612b9c 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -91,7 +91,7 @@ sub index : Path : Args(0) { $c->stash->{comments} = \%comment_counts; - my $alerts = $c->model('DB::Alert')->summary_count( $c->cobrand->restriction ); + my $alerts = $c->model('DB::Alert')->summary_report_alerts( $c->cobrand->restriction ); my %alert_counts = map { $_->confirmed => $_->get_column('confirmed_count') } $alerts->all; diff --git a/perllib/FixMyStreet/DB/ResultSet/Alert.pm b/perllib/FixMyStreet/DB/ResultSet/Alert.pm index 1866e9b06..c61053fff 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Alert.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Alert.pm @@ -35,6 +35,13 @@ sub timeline_disabled { ); } +# Return summary for alerts on reports (so excluding alerts on updates) +sub summary_report_alerts { + my ( $rs, $restriction ) = @_; + $rs = $rs->search({ alert_type => { '!=', 'new_updates' } }); + return $rs->summary_count($restriction); +} + sub summary_count { my ( $rs, $restriction ) = @_; @@ -47,4 +54,5 @@ sub summary_count { } ); } + 1; diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 42fd076c7..92cbbc00f 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -63,8 +63,8 @@ my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( my $alert = FixMyStreet::App->model('DB::Alert')->find_or_create( { - alert_type => 'new_updates', - parameter => $report->id, + alert_type => 'area_problems', + parameter => 2482, confirmed => 1, user => $user, }, diff --git a/templates/web/base/status/stats.html b/templates/web/base/status/stats.html index 9cc250dcb..f847db2ef 100644 --- a/templates/web/base/status/stats.html +++ b/templates/web/base/status/stats.html @@ -5,7 +5,7 @@ total_problems_users = total_problems_users | format_number; comments_confirmed = (comments.confirmed || 0) | format_number; alerts_1 = alerts.1 | format_number; - alerts_0 = alerts.1 | format_number; + alerts_0 = alerts.0 | format_number; questionnaires_total = questionnaires.total | format_number; questionnaires_1 = questionnaires.1 | format_number; total_bodies = total_bodies | format_number; |