diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-06-29 16:07:52 +0100 |
---|---|---|
committer | M Somerville <matthew-github@dracos.co.uk> | 2020-11-11 10:29:05 +0000 |
commit | dbde76a5090e772c806bd189426ee078b9b7e4ba (patch) | |
tree | f15015485554b852865e2388063a6942940f8340 /perllib/FixMyStreet/Cobrand/FixMyStreet.pm | |
parent | ce1b3ec61fdaa954c26e55b8ce8cd1ad619b3538 (diff) |
[Bromley] Add waste reporting service.
This creates a non-map property-based reporting flow for reporting
missed collections and requesting new containers. Such reports are
always private, in categories that are hidden from the map filters
and never shown on .com.
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/FixMyStreet.pm')
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyStreet.pm | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm index 7344a0f5e..ae96924d8 100644 --- a/perllib/FixMyStreet/Cobrand/FixMyStreet.pm +++ b/perllib/FixMyStreet/Cobrand/FixMyStreet.pm @@ -35,15 +35,19 @@ sub restriction { return {}; } -# FixMyStreet needs to not show TfL reports... +# FixMyStreet needs to not show TfL reports or Bromley waste reports sub problems_restriction { my ($self, $rs) = @_; my $table = ref $rs eq 'FixMyStreet::DB::ResultSet::Nearby' ? 'problem' : 'me'; - return $rs->search({ "$table.cobrand" => { '!=' => 'tfl' } }); + return $rs->search({ + "$table.cobrand" => { '!=' => 'tfl' }, + "$table.cobrand_data" => { '!=' => 'waste' }, + }); } sub problems_sql_restriction { my $self = shift; return "AND cobrand != 'tfl'"; + # Doesn't need Bromley one as all waste reports non-public } sub relative_url_for_report { @@ -61,6 +65,10 @@ sub munge_around_category_where { # can't determine the body $where->{send_method} = [ { '!=' => 'Triage' }, undef ]; } + my $bromley = grep { $_->name eq 'Bromley Council' } @{ $self->{c}->stash->{around_bodies} }; + if ($bromley) { + $where->{extra} = [ undef, { -not_like => '%Waste%' } ]; + } } sub _iow_category_munge { @@ -75,13 +83,16 @@ sub _iow_category_munge { @$categories = grep { $_->send_method && $_->send_method eq 'Triage' } @$categories; } -sub munge_reports_categories_list { +sub munge_reports_category_list { my ($self, $categories) = @_; my %bodies = map { $_->body->name => $_->body } @$categories; if ( my $body = $bodies{'Isle of Wight Council'} ) { return $self->_iow_category_munge($body, $categories); } + if ( $bodies{'Bromley Council'} ) { + @$categories = grep { grep { $_ ne 'Waste' } @{$_->groups} } @$categories; + } } sub munge_reports_area_list { @@ -122,6 +133,9 @@ sub munge_report_new_contacts { if ( my $body = $bodies{'Isle of Wight Council'} ) { return $self->_iow_category_munge($body, $contacts); } + if ( $bodies{'Bromley Council'} ) { + @$contacts = grep { grep { $_ ne 'Waste' } @{$_->groups} } @$contacts; + } if ( $bodies{'TfL'} ) { # Presented categories vary if we're on/off a red route my $tfl = FixMyStreet::Cobrand->get_class_for_moniker( 'tfl' )->new({ c => $self->{c} }); |