blob: d324539427d07b1b367d85fb294c6ebe6095166d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
package FixMyStreet::DB::ResultSet::Contact;
use base 'DBIx::Class::ResultSet';
use strict;
use warnings;
sub me { join('.', shift->current_source_alias, shift || q{}) }
=head2 not_deleted
$rs = $rs->not_deleted();
Filter down to not deleted contacts (so active or inactive).
=cut
sub not_deleted {
my $rs = shift;
return $rs->search( { $rs->me('state') => { '!=' => 'deleted' } } );
}
sub summary_count {
my ( $rs, $restriction ) = @_;
return $rs->search(
$restriction,
{
group_by => ['state'],
select => [ 'state', { count => 'id' } ],
as => [qw/state state_count/]
}
);
}
1;
|