diff options
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Northamptonshire.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Comment.pm | 10 | ||||
-rw-r--r-- | t/cobrand/northamptonshire.t | 26 |
3 files changed, 45 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Northamptonshire.pm b/perllib/FixMyStreet/Cobrand/Northamptonshire.pm index 791e2f83f..26c8706cc 100644 --- a/perllib/FixMyStreet/Cobrand/Northamptonshire.pm +++ b/perllib/FixMyStreet/Cobrand/Northamptonshire.pm @@ -75,6 +75,19 @@ sub problems_on_map_restriction { return $self->problems_restriction($rs); } +sub problem_state_processed { + my ($self, $comment) = @_; + + my $state = $comment->problem_state || ''; + my $code = $comment->get_extra_metadata('external_status_code') || ''; + + if ( $state eq 'investigating' and $code eq 'further' ) { + $state = 'Under further investigation'; + } + + return $state; +} + sub privacy_policy_url { 'https://www3.northamptonshire.gov.uk/councilservices/council-and-democracy/transparency/information-policies/privacy-notice/place/Pages/street-doctor.aspx' } diff --git a/perllib/FixMyStreet/DB/Result/Comment.pm b/perllib/FixMyStreet/DB/Result/Comment.pm index b217bf96c..68e267d00 100644 --- a/perllib/FixMyStreet/DB/Result/Comment.pm +++ b/perllib/FixMyStreet/DB/Result/Comment.pm @@ -265,16 +265,18 @@ sub meta_line { }; sub problem_state_processed { - my $self = shift; + my ( $self, $c ) = @_; return 'fixed - user' if $self->mark_fixed; return 'confirmed' if $self->mark_open; - return $self->problem_state; + my $cobrand_state = $c->cobrand->call_hook(problem_state_processed => $self); + + return $cobrand_state || $self->problem_state; } sub problem_state_display { my ( $self, $c ) = @_; - my $state = $self->problem_state_processed; + my $state = $self->problem_state_processed($c); return '' unless $state; my $cobrand_name = $c->cobrand->moniker; @@ -323,7 +325,7 @@ sub as_hashref { created => $self->created, }; - $out->{problem_state} = $self->problem_state_processed; + $out->{problem_state} = $self->problem_state_processed($c); $out->{photos} = [ map { $_->{url} } @{$self->photos} ] if !$cols || $cols->{photos}; diff --git a/t/cobrand/northamptonshire.t b/t/cobrand/northamptonshire.t index 57fe319a9..11b22bdb0 100644 --- a/t/cobrand/northamptonshire.t +++ b/t/cobrand/northamptonshire.t @@ -107,6 +107,32 @@ subtest 'check updates disallowed correctly' => sub { is $cobrand->updates_disallowed($report), 1; }; +subtest 'check further investigation state' => sub { + $comment->problem_state('investigating'); + $comment->update(); + + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ { northamptonshire => '.' } ], + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $mech->get_ok('/report/' . $comment->problem_id); + }; + + $mech->content_lacks('Under further investigation'); + + $comment->set_extra_metadata('external_status_code' => 'further'); + $comment->update; + + FixMyStreet::override_config { + ALLOWED_COBRANDS => [ { northamptonshire => '.' } ], + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $mech->get_ok('/report/' . $comment->problem_id); + }; + + $mech->content_contains('Under further investigation'); +}; + subtest 'check pin colour / reference shown' => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => 'northamptonshire', |