diff options
author | Struan Donald <struan@exo.org.uk> | 2012-07-24 14:43:17 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2012-07-24 14:43:17 +0100 |
commit | 8d9d08d0a32d93b653493c3735f35a6a8e494079 (patch) | |
tree | f2d5ce39494d073fc4cab9ded63350ea8a049085 /perllib/FixMyStreet | |
parent | 8809bfc5eb256221f2ddd8653e2ab26ce28d975a (diff) |
print out message about reports that we tried to send to unconfirmed email addresses
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Email.pm | 8 |
3 files changed, 18 insertions, 5 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 0e3415448..bac367b87 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -375,6 +375,17 @@ sub send_reports { for my $sender ( keys %reporters ) { $result *= $reporters{ $sender }->send( $row, \%h ); + if ( $reporters{ $sender }->unconfirmed_counts) { + foreach my $e (keys %{ $reporters{ $sender }->unconfirmed_counts } ) { + foreach my $c (keys %{ $reporters{ $sender }->unconfirmed_counts->{$e} }) { + $notgot{$e}{$c} += $reporters{ $sender }->unconfirmed_counts->{$e}{$c}; + } + } + %note = ( + %note, + %{ $reporters{ $sender }->unconfirmed_notes } + ); + } } if ($result == mySociety::EmailUtil::EMAIL_SUCCESS) { @@ -397,7 +408,7 @@ sub send_reports { print "Council email addresses that need checking:\n" if keys %notgot; foreach my $e (keys %notgot) { foreach my $c (keys %{$notgot{$e}}) { - print $notgot{$e}{$c} . " problem, to $e category $c (" . $note{$e}{$c}. ")\n"; + print " " . $notgot{$e}{$c} . " problem, to $e category $c (" . $note{$e}{$c}. ")\n"; } } if (keys %sending_skipped_by_method) { diff --git a/perllib/FixMyStreet/SendReport.pm b/perllib/FixMyStreet/SendReport.pm index 66a31ffcc..f750ef479 100644 --- a/perllib/FixMyStreet/SendReport.pm +++ b/perllib/FixMyStreet/SendReport.pm @@ -12,6 +12,8 @@ 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 => '' ); +has 'unconfirmed_counts' => ( 'is' => 'rw', isa => 'HashRef', default => sub { {} } ); +has 'unconfirmed_notes' => ( 'is' => 'rw', isa => 'HashRef', default => sub { {} } ); sub should_skip { diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm index 404622e9c..654ed6b3a 100644 --- a/perllib/FixMyStreet/SendReport/Email.pm +++ b/perllib/FixMyStreet/SendReport/Email.pm @@ -25,11 +25,11 @@ sub build_recipient_list { unless ($confirmed) { $all_confirmed = 0; - #$note = 'Council ' . $row->council . ' deleted' - #unless $note; + $note = 'Council ' . $row->council . ' deleted' + unless $note; $council_email = 'N/A' unless $council_email; - #$notgot{$council_email}{$row->category}++; - #$note{$council_email}{$row->category} = $note; + $self->unconfirmed_counts->{$council_email}{$row->category}++; + $self->unconfirmed_notes->{$council_email}{$row->category} = $note; } push @{ $self->to }, [ $council_email, $self->councils->{ $council }->{name} ]; |