aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311/GetUpdates.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/Open311/GetUpdates.pm')
-rw-r--r--perllib/Open311/GetUpdates.pm22
1 files changed, 9 insertions, 13 deletions
diff --git a/perllib/Open311/GetUpdates.pm b/perllib/Open311/GetUpdates.pm
index 7441f7f6d..5007a1f82 100644
--- a/perllib/Open311/GetUpdates.pm
+++ b/perllib/Open311/GetUpdates.pm
@@ -4,26 +4,22 @@ use Moose;
use Open311;
use FixMyStreet::App;
-has council_list => ( is => 'ro' );
+has body_list => ( is => 'ro' );
has system_user => ( is => 'ro' );
sub get_updates {
my $self = shift;
- while ( my $council = $self->council_list->next ) {
+ while ( my $body = $self->body_list->next ) {
my $open311 = Open311->new(
- endpoint => $council->endpoint,
- jurisdiction => $council->jurisdiction,
- api_key => $council->api_key
+ endpoint => $body->endpoint,
+ jurisdiction => $body->jurisdiction,
+ api_key => $body->api_key
);
- my $area_id = $council->area_id;
-
- my $council_details = mySociety::MaPit::call( 'area', $area_id );
-
my $reports = FixMyStreet::App->model('DB::Problem')->search(
{
- council => { like => "\%$area_id\%" },
+ bodies_str => { like => "\%" . $body->id . "\%" },
state => { 'IN', [qw/confirmed fixed/] },
-and => [
external_id => { '!=', undef },
@@ -39,12 +35,12 @@ sub get_updates {
next unless @report_ids;
- $self->update_reports( \@report_ids, $open311, $council_details );
+ $self->update_reports( \@report_ids, $open311, $body );
}
}
sub update_reports {
- my ( $self, $report_ids, $open311, $council_details ) = @_;
+ my ( $self, $report_ids, $open311, $body ) = @_;
my $service_requests = $open311->get_service_requests( $report_ids );
@@ -74,7 +70,7 @@ sub update_reports {
if (my $p = $problem->first) {
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($p->cobrand)->new();
$cobrand->set_lang_and_domain($p->lang, 1, FixMyStreet->path_to('locale')->stringify );
- $p->update_from_open311_service_request( $request, $council_details, $self->system_user );
+ $p->update_from_open311_service_request( $request, $body, $self->system_user );
}
}