diff --git a/scripts/add-supporter.plx b/scripts/add-supporter.plx index 32513d0..fdb5e83 100755 --- a/scripts/add-supporter.plx +++ b/scripts/add-supporter.plx @@ -70,8 +70,16 @@ while (my $line = ) { my $sp = new Supporters($dbh, [ "none" ]); -my $donorId = $sp->addSupporter({ ledger_entity_id => $entityId, email_address => $email, email_address_type => $emailType, - display_name => $displayName, public_ack => $publicAck} ); +my $args = {}; +$args->{ledger_entity_id} = $entityId; +$args->{display_name} = $displayName; +$args->{public_ack} = $publicAck; +if (defined $email and email !~ /^\s*$/) { + $args->{email_address} = $email; + $args->{email_address_type} = $emailType; +} + +my $donorId = $sp->addSupporter($args); if ($tshirt) { my $requestParamaters = { donorId => $donorId, requestConfiguration => $tshirtSize, requestType => 't-shirt-0' }; $sp->addRequest($requestParamaters); diff --git a/scripts/calculate-renewal-rate.plx b/scripts/calculate-renewal-rate.plx index ae09032..1c9b9ac 100644 --- a/scripts/calculate-renewal-rate.plx +++ b/scripts/calculate-renewal-rate.plx @@ -33,11 +33,14 @@ foreach my $supporterId (@supporterIds) { my $isLapsed = ( (not defined $expiresOn) or $expiresOn lt $TODAY); next unless $isLapsed; - print "$supporterId (", $sp->getLedgerEntityId($supporterId), ") lapsed on $expiresOn\n" if $isLapsed; + + my $lapsedStr = (defined $expiresOn) ? "lapsed on $expiresOn" : "never gave enough to be a supporter"; + + print "$supporterId (", $sp->getLedgerEntityId($supporterId), ") $lapsedStr\n" if $isLapsed; $lapsedCount++; } my $per = ( ($lapsedCount / scalar(@supporterIds)) * 100.00); print "\n\nWe have ", scalar(@supporterIds), " supporters and $lapsedCount are lapsed. That's ", - sprintf("%.2f", $per), "%.\n"; + sprintf("%.2f", $per), "%.\nActive supporter count: ", scalar(@supporterIds) - $lapsedCount, "\n";