aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311/GetServiceRequestUpdates.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/Open311/GetServiceRequestUpdates.pm')
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm27
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();