aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/ResultSet/Contact.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Contact.pm')
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Contact.pm13
1 files changed, 13 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Contact.pm b/perllib/FixMyStreet/DB/ResultSet/Contact.pm
index 52ff498a6..6fa6a03a0 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Contact.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Contact.pm
@@ -17,4 +17,17 @@ sub not_deleted {
return $rs->search( { deleted => 0 } );
}
+sub summary_count {
+ my ( $rs, $restriction ) = @_;
+
+ return $rs->search(
+ $restriction,
+ {
+ group_by => ['confirmed'],
+ select => [ 'confirmed', { count => 'id' } ],
+ as => [qw/confirmed confirmed_count/]
+ }
+ );
+}
+
1;