Commit 37171a3 1 parent f75d198 commit 37171a3 Copy full SHA for 37171a3
File tree 2 files changed +12
-1
lines changed
perllib/Open311/Endpoint/Integration
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -361,6 +361,16 @@ sub post_service_request_update {
361
361
sub get_service_request_updates {
362
362
my ($self , $args ) = @_ ;
363
363
364
+ # given we don't have an update time set a default of 20 seconds in the
365
+ # past of the end date. The -20 seconds is because FMS checks that comments
366
+ # aren't in the future WRT when it made the request so the -20 gets round
367
+ # that.
368
+ my $update_time = DateTime-> now-> add( seconds => -20 );
369
+ if ($args -> {end_date }) {
370
+ my $w3c = DateTime::Format::W3CDTF-> new;
371
+ my $update_time = $w3c -> parse_datetime($args -> {end_date });
372
+ }
373
+
364
374
my $fetched_updates = $self -> abavus-> api_call(call => ' serviceRequest/event/status' );
365
375
if ($fetched_updates -> {message } eq ' No Events Found' ) {
366
376
return ();
@@ -379,6 +389,7 @@ sub get_service_request_updates {
379
389
description => ' ' ,
380
390
update_id => $update -> {ServiceEvent }-> {guid },
381
391
service_request_id => $update -> {ServiceEvent }-> {number },
392
+ updated_datetime => $update_time ,
382
393
);
383
394
push @updates , Open311::Endpoint::Service::Request::Update::mySociety-> new( %update_args );
384
395
} else {
Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ subtest 'check fetch updates' => sub {
211
211
' status' => ' investigating' ,
212
212
' description' => ' ' ,
213
213
' media_url' => ' ' ,
214
- ' updated_datetime' => ' 2023-05-01T12:00:00Z ' ,
214
+ ' updated_datetime' => ' 2023-05-01T11:59:40Z ' ,
215
215
}
216
216
];
217
217
You can’t perform that action at this time.
0 commit comments