aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormatthew <matthew>2007-02-08 15:44:08 +0000
committermatthew <matthew>2007-02-08 15:44:08 +0000
commit657ade0b5ecbee61819f5daa019b8266579f103d (patch)
tree7ba95ec39fa7d6390f89c8f2801c4f9a8947ef42
parent44576a51c3020b1f5329273d2a562456082d0de3 (diff)
One district/county share contact address, don't email them twice.
-rwxr-xr-xbin/send-reports7
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/send-reports b/bin/send-reports
index 1b9d4bdeb..e5274be2b 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -6,7 +6,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: send-reports,v 1.13 2007-02-08 14:24:53 matthew Exp $
+# $Id: send-reports,v 1.14 2007-02-08 15:44:08 matthew Exp $
use strict;
require 5.8.0;
@@ -46,7 +46,7 @@ foreach my $row (@$unsent) {
# XXX Needs locks!
my @councils = split ',', $row->{council};
my $areas_info = mySociety::MaPit::get_voting_areas_info(\@councils);
- my (@to, @recips);
+ my (@to, %recips);
my $all_confirmed = 1;
foreach my $council (@councils) {
my $name = $areas_info->{$council}->{name};
@@ -55,8 +55,9 @@ foreach my $row (@$unsent) {
next unless $council_email; # Ignore missing councils
$all_confirmed = 0 unless $confirmed;
push @to, [ $council_email, $name ];
- push @recips, $council_email;
+ $recips{$council_email} = 1;
}
+ my @recips = keys %recips;
print 'Need to send problem #' . $row->{id} . ' to council(s) ' . join(',',@recips) . "\n";
if (!@to) {
print " ...but we have no contact details for any of them!\n";