diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-14 16:25:31 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2017-07-14 16:25:31 +0100 |
commit | 8c3f0fbfb4bcd33fa8dbc93c2ecb8e0f25ebf383 (patch) | |
tree | 0b596b32bc9248d10e6f4409e39d3285e957d40a /perllib/FixMyStreet/DB/ResultSet/Contact.pm | |
parent | 298db521933eb65591fafa218e78f5f4cdb547ad (diff) | |
parent | 426bc926a422af21ff39cebed836d34e46238500 (diff) |
Merge branch 'issues/forcouncils/192-unused-categories'
Diffstat (limited to 'perllib/FixMyStreet/DB/ResultSet/Contact.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Contact.pm | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Contact.pm b/perllib/FixMyStreet/DB/ResultSet/Contact.pm index f402b5461..8ef6d1ac5 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Contact.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Contact.pm @@ -10,13 +10,18 @@ sub me { join('.', shift->current_source_alias, shift || q{}) } $rs = $rs->not_deleted(); -Filter down to not deleted contacts - which have C<deleted> set to false; +Filter down to not deleted contacts (so active or inactive). =cut sub not_deleted { my $rs = shift; - return $rs->search( { $rs->me('deleted') => 0 } ); + return $rs->search( { $rs->me('state') => { '!=' => 'deleted' } } ); +} + +sub active { + my $rs = shift; + $rs->search( { $rs->me('state') => [ 'unconfirmed', 'confirmed' ] } ); } sub summary_count { @@ -25,9 +30,9 @@ sub summary_count { return $rs->search( $restriction, { - group_by => ['confirmed'], - select => [ 'confirmed', { count => 'id' } ], - as => [qw/confirmed confirmed_count/] + group_by => ['state'], + select => [ 'state', { count => 'id' } ], + as => [qw/state state_count/] } ); } |