aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-06-28 14:51:17 +0100
committerStruan Donald <struan@exo.org.uk>2011-06-28 14:51:17 +0100
commit96da0c04218644450f141f20c1dee4247a0ed8fe (patch)
tree833e0aa9e3ea67f4775a97f4a4d46a11cd502b7a
parentf301d83e6bd7546b2f2a80067313dd17502581f8 (diff)
correctly set mark_open/fixed in questionnaire generates updates
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Questionnaire.pm2
-rw-r--r--t/app/controller/questionnaire.t10
-rw-r--r--templates/web/default/questionnaire/completed.html2
3 files changed, 12 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
index ccf7dfba0..a146b85ce 100755
--- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm
+++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
@@ -202,7 +202,7 @@ sub submit_standard : Private {
user => $problem->user,
text => $update,
state => 'confirmed',
- mark_fixed => $new_state eq 'fixed' ? 1 : 0,
+ mark_fixed => $new_state eq 'fixed - user' ? 1 : 0,
mark_open => $new_state eq 'confirmed' ? 1 : 0,
lang => $c->stash->{lang_code},
cobrand => $c->cobrand->moniker,
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t
index ecb243709..af3b373ac 100644
--- a/t/app/controller/questionnaire.t
+++ b/t/app/controller/questionnaire.t
@@ -240,6 +240,16 @@ foreach my $test (
{ problem_id => $report->id }
);
is $c->text, $test->{fields}{update} || $test->{comment};
+ if ( $result =~ /fixed/ ) {
+ ok $c->mark_fixed, 'comment marked as fixed';
+ ok !$c->mark_open, 'comment not marked as open';
+ } elsif ( $result eq 'confirmed' ) {
+ ok $c->mark_open, 'comment marked as open';
+ ok !$c->mark_fixed, 'comment not marked as fixed';
+ } elsif ( $result eq 'unknown' ) {
+ ok !$c->mark_open, 'comment not marked as open';
+ ok !$c->mark_fixed, 'comment not marked as fixed';
+ }
}
# Reset questionnaire for next test
diff --git a/templates/web/default/questionnaire/completed.html b/templates/web/default/questionnaire/completed.html
index 3762b25d0..fe896b383 100644
--- a/templates/web/default/questionnaire/completed.html
+++ b/templates/web/default/questionnaire/completed.html
@@ -10,7 +10,7 @@
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.state == 'confirmed') %]
+[% ELSIF new_state == 'confirmed' OR (!new_state AND problem.is_open) %]
[% tprintf( loc('<p style="font-size:150%%">We&rsquo;re sorry to hear that. We have two suggestions: why not try
<a href="%s">writing direct to your councillor(s)</a>