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.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm
index 875769eac..27cb21c3a 100644
--- a/perllib/Open311/GetServiceRequestUpdates.pm
+++ b/perllib/Open311/GetServiceRequestUpdates.pm
@@ -31,7 +31,7 @@ sub fetch {
jurisdiction => $body->jurisdiction,
);
- if ( $body->area_id == 2482 ) {
+ if ( $body->areas->{2482} ) {
my $endpoints = $o->endpoints;
$endpoints->{update} = 'update.xml';
$endpoints->{service_request_updates} = 'update.xml';
@@ -40,7 +40,7 @@ sub fetch {
$self->suppress_alerts( $body->suppress_alerts );
$self->system_user( $body->comment_user );
- $self->update_comments( $o, { areaid => $body->area_id }, );
+ $self->update_comments( $o, { areas => $body->areas }, );
}
}
@@ -55,7 +55,7 @@ sub update_comments {
push @args, $self->start_date;
push @args, $self->end_date;
# default to asking for last 2 hours worth if not Bromley
- } elsif ( $body_details->{areaid} != 2482 ) {
+ } elsif ( ! $body_details->{areas}->{2482} ) {
my $end_dt = DateTime->now();
my $start_dt = $end_dt->clone;
$start_dt->add( hours => -2 );
@@ -67,7 +67,7 @@ sub update_comments {
my $requests = $open311->get_service_request_updates( @args );
unless ( $open311->success ) {
- warn "Failed to fetch ServiceRequest Updates for " . $body_details->{areaid} . ":\n" . $open311->error
+ warn "Failed to fetch ServiceRequest Updates for " . join(",", keys %{$body_details->{areas}}) . ":\n" . $open311->error
if $self->verbose;
return 0;
}
@@ -83,7 +83,8 @@ sub update_comments {
FixMyStreet::App->model('DB::Problem')
->search( {
external_id => $request_id,
- bodies_str => { like => '%' . $body_details->{areaid} . '%' },
+ # XXX This assumes that areas will actually only be one area.
+ bodies_str => { like => '%' . join(",", keys %{$body_details->{areas}}) . '%' },
} );
if (my $p = $problem->first) {