diff options
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Alert.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Alert.pm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Alert.pm b/perllib/FixMyStreet/DB/ResultSet/Alert.pm index bb1c61141..c61053fff 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Alert.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Alert.pm @@ -8,7 +8,7 @@ sub timeline_created { my ( $rs, $restriction ) = @_; my $prefetch = - FixMyStreet::App->model('DB')->schema->storage->sql_maker->quote_char ? + $rs->result_source->storage->sql_maker->quote_char ? [ qw/alert_type user/ ] : [ qw/alert_type/ ]; @@ -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; |