diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-28 13:23:09 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-28 13:23:09 +0100 |
commit | f301d83e6bd7546b2f2a80067313dd17502581f8 (patch) | |
tree | 8bf4625cd8de90944468b66460d68c8fe8e8af3c /perllib/FixMyStreet/App/Controller/Questionnaire.pm | |
parent | 2c66aa1aa7c6c07c2146ebbccbf0b25f2ea97a3e (diff) |
store correct old state in questionnaire when creator marks problem as fixed
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Questionnaire.pm')
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 6 |
1 files changed, 6 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; |