diff options
author | Struan Donald <struan@exo.org.uk> | 2013-01-17 17:14:26 +0000 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2013-01-17 17:14:26 +0000 |
commit | 3ce992eb742cfc75195fb482de09a92b15508e77 (patch) | |
tree | 48f3fcf38fd0ab64707ee959cc6eb8c619f290de | |
parent | 3f1cadfdea68a6ee4d8b3a1611597c88f9bc1d9c (diff) |
add internal review status to problems
-rw-r--r-- | db/schema.sql | 2 | ||||
-rw-r--r-- | db/schema_0025-add_more_statuses_to_problem.sql | 20 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 4 | ||||
-rw-r--r-- | perllib/Open311.pm | 2 | ||||
-rw-r--r-- | t/app/controller/report_display.t | 8 | ||||
-rw-r--r-- | t/app/controller/report_updates.t | 34 | ||||
-rw-r--r-- | t/open311.t | 7 | ||||
-rw-r--r-- | t/open311/getservicerequestupdates.t | 12 |
8 files changed, 83 insertions, 6 deletions
diff --git a/db/schema.sql b/db/schema.sql index 021c5561d..5bdd2a66a 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -193,6 +193,7 @@ create table problem ( or state = 'unable to fix' or state = 'not responsible' or state = 'duplicate' + or state = 'internal referral' ), lang text not null default 'en-gb', service text not null default '', @@ -343,6 +344,7 @@ create table comment ( or problem_state = 'unable to fix' or problem_state = 'not responsible' or problem_state = 'duplicate' + or problem_state = 'internal referral' ), -- other fields? one to indicate whether this was written by the council -- and should be highlighted in the display? diff --git a/db/schema_0025-add_more_statuses_to_problem.sql b/db/schema_0025-add_more_statuses_to_problem.sql index 9c49c8566..14d1b3195 100644 --- a/db/schema_0025-add_more_statuses_to_problem.sql +++ b/db/schema_0025-add_more_statuses_to_problem.sql @@ -18,6 +18,7 @@ BEGIN; or state = 'unable to fix' or state = 'not responsible' or state = 'duplicate' + or state = 'internal referral' ); @@ -36,40 +37,47 @@ BEGIN; or problem_state = 'unable to fix' or problem_state = 'not responsible' or problem_state = 'duplicate' + or problem_state = 'internal referral' ); UPDATE alert_type set item_where = 'nearby.problem_id = problem.id and problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'', - ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'' )' + ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'', + ''internal referral'')' WHERE ref = 'postcode_local_problems'; UPDATE alert_type set item_where = 'problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'' - ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'' )' + ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'', + ''internal referral'' )' WHERE ref = 'new_problems'; UPDATE alert_type set item_where = 'problem.state in (''fixed'', ''fixed - user'', ''fixed - council'')' WHERE ref = 'new_fixed_problems'; UPDATE alert_type set item_where = 'nearby.problem_id = problem.id and problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'', - ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'' )' + ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'', + ''internal referral'')' WHERE ref = 'local_problems'; UPDATE alert_type set item_where = 'problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'', - ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'' ) AND + ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'', + ''internal referral'' ) AND (council like ''%''||?||''%'' or council is null) and areas like ''%,''||?||'',%''' WHERE ref = 'council_problems'; UPDATE alert_type set item_where = 'problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'', - ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'' ) AND + ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'', + ''internal referral'' ) AND (council like ''%''||?||''%'' or council is null) and areas like ''%,''||?||'',%''' WHERE ref = 'ward_problems'; UPDATE alert_type set item_where = 'problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'', - ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'' ) AND + ''action scheduled'', ''not responsible'', ''duplicate'', ''unable to fix'', + ''internal referral'' ) AND areas like ''%,''||?||'',%''' WHERE ref = 'area_problems'; COMMIT; diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index b1f59e78a..26724303e 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -242,6 +242,7 @@ sub closed_states { 'unable to fix' => 1, 'not responsible' => 1, 'duplicate' => 1, + 'internal referral' => 1, }; return wantarray ? keys %{$states} : $states; @@ -272,6 +273,7 @@ sub visible_states { 'not responsible' => 1, 'duplicate' => 1, 'closed' => 1, + 'internal referral' => 1, }; return wantarray ? keys %{$states} : $states; @@ -303,6 +305,7 @@ sub all_states { 'not responsible' => 1, 'duplicate' => 1, 'closed' => 1, + 'internal referral' => 1, }; return wantarray ? keys %{$states} : $states; @@ -327,6 +330,7 @@ sub council_states { 'unable to fix' => 1, 'not responsible' => 1, 'duplicate' => 1, + 'internal referral' => 1, }; return wantarray ? keys %{$states} : $states; diff --git a/perllib/Open311.pm b/perllib/Open311.pm index e506ec1d0..efa0ac64f 100644 --- a/perllib/Open311.pm +++ b/perllib/Open311.pm @@ -312,6 +312,8 @@ sub _populate_service_request_update_params { $status = 'NOT_COUNCILS_RESPONSIBILITY'; } elsif ( $state eq 'unable to fix' ) { $status = 'NO_FURTHER_ACTION'; + } elsif ( $state eq 'internal referral' ) { + $status = 'INTERNAL_REFERRAL'; } } else { if ( !FixMyStreet::DB::Result::Problem->open_states()->{$state} ) { diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t index 82c98dc5c..aa04e499b 100644 --- a/t/app/controller/report_display.t +++ b/t/app/controller/report_display.t @@ -307,6 +307,14 @@ for my $test ( fixed => 0 }, { + description => 'internal referral report', + date => DateTime->now, + state => 'internal referral', + banner_id => 'closed', + banner_text => 'closed', + fixed => 0 + }, + { description => 'closed report', date => DateTime->now, state => 'closed', diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t index 12ac5d654..6510a5324 100644 --- a/t/app/controller/report_updates.t +++ b/t/app/controller/report_updates.t @@ -538,6 +538,18 @@ for my $test ( state => 'unable to fix', }, { + desc => 'from authority user marks report as internal referral', + fields => { + name => $user->name, + may_show_name => 1, + add_alert => undef, + photo => '', + update => 'Set state to internal referral', + state => 'internal referral', + }, + state => 'internal referral', + }, + { desc => 'from authority user marks report as not responsible', fields => { name => $user->name, @@ -1480,6 +1492,17 @@ for my $test ( end_state => 'unable to fix', }, { + desc => 'update internal referral without marking as fixed leaves state unchanged', + initial_state => 'internal referral', + expected_form_fields => { + fixed => undef, + }, + submitted_form_fields => { + fixed => 0, + }, + end_state => 'internal referral', + }, + { desc => 'update not responsible without marking as fixed leaves state unchanged', initial_state => 'not responsible', expected_form_fields => { @@ -1568,6 +1591,17 @@ for my $test ( end_state => 'fixed - user', }, { + desc => 'can mark internal referral as fixed, cannot mark not closed', + initial_state => 'internal referral', + expected_form_fields => { + fixed => undef, + }, + submitted_form_fields => { + fixed => 1, + }, + end_state => 'fixed - user', + }, + { desc => 'can mark not responsible as fixed, cannot mark not closed', initial_state => 'not responsible', expected_form_fields => { diff --git a/t/open311.t b/t/open311.t index ad20c3859..71a87325c 100644 --- a/t/open311.t +++ b/t/open311.t @@ -295,6 +295,13 @@ foreach my $test ( extended => 'NO_FURTHER_ACTION', }, { + desc => 'comment with internal referral state sends status of CLOSED', + state => 'internal referral', + anon => 0, + status => 'CLOSED', + extended => 'INTERNAL_REFERRAL', + }, + { desc => 'comment with closed state sends status of CLOSED', state => 'closed', status => 'CLOSED', diff --git a/t/open311/getservicerequestupdates.t b/t/open311/getservicerequestupdates.t index 3f9c35c32..ba2854460 100644 --- a/t/open311/getservicerequestupdates.t +++ b/t/open311/getservicerequestupdates.t @@ -204,6 +204,18 @@ for my $test ( end_state => 'not responsible', }, { + desc => 'internal referral status changes problem status', + updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ), + description => 'This is a note', + external_id => 638344, + start_state => 'confirmed', + comment_status => 'INTERNAL_REFERRAL', + mark_fixed=> 0, + mark_open => 0, + problem_state => 'internal referral', + end_state => 'internal referral', + }, + { desc => 'duplicate status changes problem status', updated_datetime => sprintf( '<updated_datetime>%s</updated_datetime>', $dt ), description => 'This is a note', |