Add lapsed count to output for status report.
This commit is contained in:
parent
6137907548
commit
279c3e33f9
1 changed files with 9 additions and 2 deletions
|
@ -41,6 +41,7 @@ my @lapseCategories = ('00-lapsing-this-week', '01-lapsing-this-month', '02-laps
|
||||||
foreach my $cat (@lapseCategories) {
|
foreach my $cat (@lapseCategories) {
|
||||||
$expireReport{$cat}{list} = [];
|
$expireReport{$cat}{list} = [];
|
||||||
}
|
}
|
||||||
|
my $lapsedCount = 0;
|
||||||
|
|
||||||
foreach my $supporterId (@supporterIds) {
|
foreach my $supporterId (@supporterIds) {
|
||||||
my $expiresOn = $sp->supporterExpirationDate($supporterId);
|
my $expiresOn = $sp->supporterExpirationDate($supporterId);
|
||||||
|
@ -48,6 +49,7 @@ foreach my $supporterId (@supporterIds) {
|
||||||
my $lapsesInOneWeek = ( (defined $expiresOn) and $expiresOn le $ONE_WEEK);
|
my $lapsesInOneWeek = ( (defined $expiresOn) and $expiresOn le $ONE_WEEK);
|
||||||
my $lapsesInOneMonth = ( (defined $expiresOn) and $expiresOn le $ONE_MONTH);
|
my $lapsesInOneMonth = ( (defined $expiresOn) and $expiresOn le $ONE_MONTH);
|
||||||
$expiresOn = "NO-FULL-SIGNUP" if not defined $expiresOn;
|
$expiresOn = "NO-FULL-SIGNUP" if not defined $expiresOn;
|
||||||
|
$lapsedCount++ if $isLapsed;
|
||||||
my %emails;
|
my %emails;
|
||||||
my $email = $sp->getPreferredEmailAddress($supporterId);
|
my $email = $sp->getPreferredEmailAddress($supporterId);
|
||||||
if (defined $email) {
|
if (defined $email) {
|
||||||
|
@ -109,7 +111,12 @@ foreach my $supporterId (@supporterIds) {
|
||||||
$sp->addRequest({donorId => $supporterId, requestType => $REQUEST_NAME});
|
$sp->addRequest({donorId => $supporterId, requestType => $REQUEST_NAME});
|
||||||
}
|
}
|
||||||
|
|
||||||
my $emailText = "";
|
my $subject = "Supporter lapsed report for $TODAY";
|
||||||
|
my $per = ( ($lapsedCount / scalar(@supporterIds)) * 100.00);
|
||||||
|
my $emailText = "$subject\n" . ("=" x length($subject)) .
|
||||||
|
"\n\nWe have " . scalar(@supporterIds) . " supporters and $lapsedCount are lapsed. That's " .
|
||||||
|
sprintf("%.2f", $per) . "%.\nActive supporter count: " . (scalar(@supporterIds) - $lapsedCount) . "\n\n";
|
||||||
|
|
||||||
foreach my $cat (sort { $a cmp $b } @lapseCategories) {
|
foreach my $cat (sort { $a cmp $b } @lapseCategories) {
|
||||||
my $heading = scalar(@{$expireReport{$cat}{list}}) . " " . $expireReport{$cat}{description};
|
my $heading = scalar(@{$expireReport{$cat}{list}}) . " " . $expireReport{$cat}{description};
|
||||||
$emailText .= "$heading\n";
|
$emailText .= "$heading\n";
|
||||||
|
@ -126,7 +133,7 @@ my $email = Email::MIME->create(
|
||||||
header_str => [
|
header_str => [
|
||||||
To => $FROM_ADDRESS,
|
To => $FROM_ADDRESS,
|
||||||
From => $FROM_ADDRESS,
|
From => $FROM_ADDRESS,
|
||||||
Subject => "Supporter lapsed report for $TODAY" ],
|
Subject => $subject ],
|
||||||
attributes => {
|
attributes => {
|
||||||
content_type => 'text/plain',
|
content_type => 'text/plain',
|
||||||
charset => 'utf-8',
|
charset => 'utf-8',
|
||||||
|
|
Loading…
Reference in a new issue