diff options
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 15 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Barnet.pm | 11 |
3 files changed, 23 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 30ad41704..8ec68a440 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -234,6 +234,7 @@ sub send_reports { my $send_report = FixMyStreet::SendReport->new(); my $senders = $send_report->get_senders; + my %sending_skipped_by_method; while (my $row = $unsent->next) { @@ -320,7 +321,10 @@ sub send_reports { } $reporters{ $sender } ||= $sender->new(); - unless ( $reporters{ $sender }->should_skip( $row ) ) { + if ( $reporters{ $sender }->should_skip( $row ) ) { + $sending_skipped_by_method{ $sender }++ if + $reporters{ $sender }->skipped; + } else { push @dear, $name; $reporters{ $sender }->add_council( $council, $name ); } @@ -408,6 +412,15 @@ sub send_reports { print $notgot{$e}{$c} . " problem, to $e category $c (" . $note{$e}{$c}. ")\n"; } } + if (keys %sending_skipped_by_method) { + my $c = 0; + print "\nProblem reports that send-reports did not attempt to send the following:\n"; + foreach my $send_method (sort keys %sending_skipped_by_method) { + printf " %-24s %4d\n", "$send_method:", $sending_skipped_by_method{$send_method}; + $c+=$sending_skipped_by_method{$send_method}; + } + printf " %-24s %4d\n", "Total:", $c; + } } } diff --git a/perllib/FixMyStreet/SendReport.pm b/perllib/FixMyStreet/SendReport.pm index 426e8eefe..915fe4a20 100644 --- a/perllib/FixMyStreet/SendReport.pm +++ b/perllib/FixMyStreet/SendReport.pm @@ -11,6 +11,7 @@ has 'councils' => ( is => 'rw', isa => 'HashRef', default => sub { {} } ); has 'to' => ( is => 'rw', isa => 'ArrayRef', default => sub { [] } ); has 'success' => ( is => 'rw', isa => 'Bool', default => 0 ); has 'error' => ( is => 'rw', isa => 'Str', default => '' ); +has 'skipped' => ( 'is' => 'rw', isa => 'Str', default => '' ); sub should_skip { diff --git a/perllib/FixMyStreet/SendReport/Barnet.pm b/perllib/FixMyStreet/SendReport/Barnet.pm index 72c279282..3eb8d2048 100644 --- a/perllib/FixMyStreet/SendReport/Barnet.pm +++ b/perllib/FixMyStreet/SendReport/Barnet.pm @@ -5,6 +5,7 @@ use Moose; BEGIN { extends 'FixMyStreet::SendReport'; } use BarnetInterfaces::service::ZLBB_SERVICE_ORDER; +use Encode; use Utils; use mySociety::Config; use mySociety::Web qw(ent); @@ -14,7 +15,6 @@ use constant SEND_FAIL_RETRIES_CUTOFF => 3; # specific council numbers use constant COUNCIL_ID_BARNET => 2489; - use constant MAX_LINE_LENGTH => 132; sub should_skip { @@ -29,11 +29,12 @@ sub should_skip { $err_msg = "skipped: problem id=" . $problem->id . " send$council_name has failed " . $problem->send_fail_count . " times, cutoff is " . SEND_FAIL_RETRIES_CUTOFF; + $self->skipped( $err_msg ); + return 1; } } -# currently just blind copy of construct_easthants_message sub construct_message { my %h = @_; my $message = <<EOF; @@ -55,7 +56,7 @@ sub send { my %h = %$h; - $h{message} = construct_barnet_message(%h); + $h{message} = construct_message(%h); my $return = 1; my $err_msg = ""; @@ -83,6 +84,10 @@ sub send { $interface->set_proxy($council_config->endpoint); # Barnet web service doesn't like namespaces in the elements so use a prefix $interface->set_prefix('urn'); + # uncomment these lines to print XML that will be sent rather + # than connecting to the endpoint + #$interface->outputxml(1); + #$interface->no_dispatch(1); } else { die "Barnet webservice FAIL: looks like you're missing some config data: no endpoint (URL) found for area_id=" . COUNCIL_ID_BARNET; } |