diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-04-27 20:45:18 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-04-27 20:45:18 +0100 |
commit | bf165e6b5ab09e32b1806e06a837bda1bdec40db (patch) | |
tree | 8243a64cb5c930b3f14220537621f2f31b2342e0 /perllib/Open311/GetServiceRequestUpdates.pm | |
parent | df4aaab5222604ff9803510f182701522882c309 (diff) | |
parent | 810759ae13d7dca1b16f36841ca7d364c1738cb5 (diff) |
Merge branch 'open311-skip-out-of-range'
Diffstat (limited to 'perllib/Open311/GetServiceRequestUpdates.pm')
-rw-r--r-- | perllib/Open311/GetServiceRequestUpdates.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index 11bc1e64f..daa5fb64d 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -89,6 +89,13 @@ sub update_comments { # what problem it belongs to so just skip next unless $request_id; + my $comment_time = eval { + DateTime::Format::W3CDTF->parse_datetime( $request->{updated_datetime} || "" ); + }; + next if $@; + my $updated = DateTime::Format::W3CDTF->format_datetime($comment_time->clone->set_time_zone('UTC')); + next if @args && ($updated lt $args[0] || $updated gt $args[1]); + my $problem; my $criteria = { external_id => $request_id, @@ -99,8 +106,6 @@ sub update_comments { my $c = $p->comments->search( { external_id => $request->{update_id} } ); if ( !$c->first ) { - my $comment_time = DateTime::Format::W3CDTF->parse_datetime( $request->{updated_datetime} ); - my $comment = $self->schema->resultset('Comment')->new( { problem => $p, |