aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Questionnaire.pm6
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm4
2 files changed, 10 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
index ad3827de9..ccf7dfba0 100755
--- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm
+++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm
@@ -128,13 +128,19 @@ sub submit_creator_fixed : Private {
my $questionnaire = $c->model( 'DB::Questionnaire' )->find_or_new(
{
problem_id => $c->stash->{problem},
+ # we want to look for any previous questionnaire here rather than one for
+ # this specific open state -> fixed transistion
old_state => [ FixMyStreet::DB::Result::Problem->open_states() ],
new_state => 'fixed - user',
}
);
unless ( $questionnaire->in_storage ) {
+ my $old_state = $c->flash->{old_state};
+ $old_state = 'confirmed' unless FixMyStreet::DB::Result::Problem->open_states->{$old_state};
+
$questionnaire->ever_reported( $c->stash->{reported} eq 'Yes' ? 1 : 0 );
+ $questionnaire->old_state( $old_state );
$questionnaire->whensent( \'ms_current_timestamp()' );
$questionnaire->whenanswered( \'ms_current_timestamp()' );
$questionnaire->insert;
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index 1ea0e88b4..76bd89174 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -51,6 +51,9 @@ sub update_problem : Private {
my $update = $c->stash->{update};
my $problem = $c->stash->{problem} || $update->problem;
+ # we may need this if we display the questionnaire
+ my $old_state = $problem->state;
+
if ( $update->mark_fixed ) {
$problem->state('fixed - user');
@@ -75,6 +78,7 @@ sub update_problem : Private {
$c->stash->{problem_id} = $problem->id;
if ($display_questionnaire) {
+ $c->flash->{old_state} = $old_state;
$c->detach('/questionnaire/creator_fixed');
}