diff options
author | Struan Donald <struan@exo.org.uk> | 2012-04-27 16:19:05 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-04-27 16:19:05 +0100 |
commit | 88d2190f909dc6bfff625834d044a764c8764ce6 (patch) | |
tree | af854035f325bca161374e88c987e3fd490cd9fc /perllib/Open311/GetServiceRequestUpdates.pm | |
parent | 7cfdeebf2e65361e0141a7955b70588700bd5cbe (diff) |
do not update problem state if comment is older than most recent update
Diffstat (limited to 'perllib/Open311/GetServiceRequestUpdates.pm')
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index f17c6e685..28c7140ed 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -90,16 +90,23 @@ sub update_comments { } ); - if ( $p->is_open and lc($request->{status}) eq 'closed' ) { - $p->state( 'fixed - council' ); - $p->update; - - $comment->mark_fixed( 1 ); - } elsif ( ( $p->is_closed || $p->is_fixed ) and lc($request->{status}) eq 'open' ) { - $p->state( 'confirmed' ); - $p->update; - - $comment->mark_open( 1 ); + # if the comment is older than the last update + # do not change the status of the problem as it's + # tricky to determine the right thing to do. + if ( $comment->created > $p->lastupdate ) { + if ( $p->is_open and lc($request->{status}) eq 'closed' ) { + $p->state( 'fixed - council' ); + $p->last_update( $comment->created ); + $p->update; + + $comment->mark_fixed( 1 ); + } elsif ( ( $p->is_closed || $p->is_fixed ) and lc($request->{status}) eq 'open' ) { + $p->state( 'confirmed' ); + $p->last_update( $comment->created ); + $p->update; + + $comment->mark_open( 1 ); + } } $comment->insert(); |