aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311/GetServiceRequestUpdates.pm
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2016-05-28 13:49:00 +0200
committerMarius Halden <marius.h@lden.org>2016-05-28 13:49:00 +0200
commit6791ce86ae15adbded24bd814a78cc0e87f404fa (patch)
tree99af5da31e4db091350a09bcdee913c99abc2fc3 /perllib/Open311/GetServiceRequestUpdates.pm
parent6c1118dbf2c4b15bcfcd77600d36f2389428c75e (diff)
parent89b0efeb94631c4c31ce33e7f98297e754dd226d (diff)
Merge tag 'v1.8.2' into fiksgatami-dev
Diffstat (limited to 'perllib/Open311/GetServiceRequestUpdates.pm')
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm9
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,