diff options
author | matthew <matthew> | 2007-05-09 16:54:48 +0000 |
---|---|---|
committer | matthew <matthew> | 2007-05-09 16:54:48 +0000 |
commit | d6cfe54df9ffc7244487247a2ba7fb455f8e2ba8 (patch) | |
tree | 60af13c1469a90258ba129d18450365a5282418e | |
parent | f4109f49d5bae73bf40e975300aa322db9a98c2d (diff) |
Record old/new state of problem in questionnaire table, to have information
to hand. Should have done this in the first place, sigh.
-rw-r--r-- | db/schema.sql | 7 | ||||
-rwxr-xr-x | web/questionnaire.cgi | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/db/schema.sql b/db/schema.sql index d9a08c629..4b4334000 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -4,7 +4,7 @@ -- Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. -- Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ -- --- $Id: schema.sql,v 1.29 2007-05-09 11:13:39 francis Exp $ +-- $Id: schema.sql,v 1.30 2007-05-09 16:54:48 matthew Exp $ -- -- secret @@ -158,7 +158,10 @@ create table questionnaire ( whenanswered timestamp, -- whether have ever previously reported a problem to a council or not - ever_reported boolean + ever_reported boolean, + -- problem state before and after questionnaire + old_state text, + new_state text ); -- angle_between A1 A2 diff --git a/web/questionnaire.cgi b/web/questionnaire.cgi index 910c87f87..bb2441aad 100755 --- a/web/questionnaire.cgi +++ b/web/questionnaire.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: questionnaire.cgi,v 1.5 2007-05-09 16:30:36 matthew Exp $ +# $Id: questionnaire.cgi,v 1.6 2007-05-09 16:54:48 matthew Exp $ use strict; require 5.8.0; @@ -114,7 +114,9 @@ sub submit_questionnaire { my $reported = $input{reported} eq 'Yes' ? 't' : ($input{reported} eq 'No' ? 'f' : undef); dbh()->do('update questionnaire set whenanswered=ms_current_timestamp(), - ever_reported=? where id=?', {}, $reported, $questionnaire->{id}); + ever_reported=?, old_state=?, new_state=? where id=?', {}, + $reported, $problem->{state}, $new_state ? $new_state : $problem->{state}, + $questionnaire->{id}); # Record an update if they've given one, or if there's a state change my $name = $problem->{anonymous} ? undef : $problem->{name}; |