diff options
author | Dave Whiteland <dave@mysociety.org> | 2012-10-03 17:57:29 +0100 |
---|---|---|
committer | Dave Whiteland <dave@mysociety.org> | 2012-10-03 17:57:29 +0100 |
commit | fae33181698a051204c933a42c4587e985f2d984 (patch) | |
tree | 0049569fd0fd0d42a2137e59f79e8384450cbc37 | |
parent | 272dba7ce6d59d81b52579dd4c5fc7d65e9bec20 (diff) | |
parent | 5b3824c84f0ade0d8ac9258eb30379f8d7e11023 (diff) |
Merge branch 'master' of ssh://git.mysociety.org/data/git/public/fixmystreet
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 2 | ||||
-rw-r--r-- | t/app/controller/questionnaire.t | 26 | ||||
-rw-r--r-- | templates/web/default/questionnaire/completed.html | 4 |
3 files changed, 28 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index f0cc72e07..46d6350d7 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -157,6 +157,8 @@ sub submit_standard : Private { my $new_state = ''; $new_state = 'fixed - user' if $c->stash->{been_fixed} eq 'Yes' && FixMyStreet::DB::Result::Problem->open_states()->{$old_state}; + $new_state = 'fixed - user' if $c->stash->{been_fixed} eq 'Yes' && + FixMyStreet::DB::Result::Problem->closed_states()->{$old_state}; $new_state = 'confirmed' if $c->stash->{been_fixed} eq 'No' && FixMyStreet::DB::Result::Problem->fixed_states()->{$old_state}; diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t index 3475307fb..3a6a3d6ad 100644 --- a/t/app/controller/questionnaire.t +++ b/t/app/controller/questionnaire.t @@ -190,6 +190,25 @@ foreach my $test ( # update => 'Dummy', Error for not setting this tested below }, }, + { + desc => 'Closed report, said fixed, reported before, no update, no further questionnaire', + problem_state => 'closed', + fields => { + been_fixed => 'Yes', + reported => 'Yes', + another => 'No', + }, + }, + { + desc => 'Closed report, said not fixed, reported before, no update, no further questionnaire', + problem_state => 'closed', + fields => { + been_fixed => 'No', + reported => 'Yes', + another => 'No', + }, + lastupdate_static => 1, + }, ) { subtest $test->{desc} => sub { $report->state ( $test->{problem_state} ); @@ -224,7 +243,8 @@ foreach my $test ( $result = 'fixed' if $test->{fields}{been_fixed} eq 'Yes' && $test->{problem_state} eq 'fixed'; - $result = 'confirmed' if $test->{fields}{been_fixed} eq 'No'; + $result = 'confirmed' if $test->{fields}{been_fixed} eq 'No' && $test->{problem_state} ne 'closed'; + $result = 'closed' if $test->{fields}{been_fixed} eq 'No' && $test->{problem_state} eq 'closed'; $result = 'unknown' if $test->{fields}{been_fixed} eq 'Unknown'; my $another = 0; @@ -234,10 +254,12 @@ foreach my $test ( $mech->content_like( qr/<title>[^<]*Questionnaire/m ); $mech->content_contains( 'glad to hear it’s been fixed' ) if $result =~ /fixed/; + $mech->content_lacks( 'glad to hear it’s been fixed' ) + if $result !~ /fixed/; $mech->content_contains( 'get some more information about the status of your problem' ) if $result eq 'unknown'; $mech->content_contains( "sorry to hear that" ) - if $result eq 'confirmed'; + if $result eq 'confirmed' || $result eq 'closed'; # Check the database has the right information $report->discard_changes; diff --git a/templates/web/default/questionnaire/completed.html b/templates/web/default/questionnaire/completed.html index a125d48bd..52c20652c 100644 --- a/templates/web/default/questionnaire/completed.html +++ b/templates/web/default/questionnaire/completed.html @@ -10,12 +10,12 @@ get some more information about the status of your problem, please come back to the site and leave an update.</p>') %] -[% ELSIF new_state == 'confirmed' OR (!new_state AND problem.is_open) %] +[% ELSIF new_state == 'confirmed' OR (!new_state AND problem.is_open) OR (!new_state AND problem.is_closed) %] [% INCLUDE 'questionnaire/completed-open.html' %] [% advert_outcome = 0 %] -[% ELSE %] +[% ELSIF been_fixed == 'Yes' %] [% loc('<p style="font-size:150%">Thank you very much for filling in our questionnaire; glad to hear it’s been fixed.</p>') %] |