From ace578089c1db4eb40857bb5e898b9abf60bf25a Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Sun, 22 Jul 2018 15:31:18 -0700 Subject: [PATCH] count old interns. --- scripts/rt-outreachy-payment-next.plx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/rt-outreachy-payment-next.plx b/scripts/rt-outreachy-payment-next.plx index 30af82c..4c2a1c9 100755 --- a/scripts/rt-outreachy-payment-next.plx +++ b/scripts/rt-outreachy-payment-next.plx @@ -149,6 +149,8 @@ $VERBOSE = 0 unless defined $VERBOSE; opendir(my $dh, $PAYMENT_DIR); +my $oldInterns = 0; + while (my $file = readdir $dh) { unless ($file =~ /^\s*(success|faile?d?)-(\S+)\.txt\s*$/i) { print STDERR "Skipping $file which does not match proper format...\n" if ($VERBOSE >= 2); @@ -175,6 +177,7 @@ while (my $file = readdir $dh) { foreach my $name (@nameComponents) { push(@searchTerms, 'Subject LIKE "' . $name . '"'); } + # Find the ticket number for this intern. my $ticket = FindUniqueTicket(@searchTerms); if (not defined $ticket) { foreach my $term (@searchTerms) { @@ -191,7 +194,15 @@ while (my $file = readdir $dh) { die "interactive mode not yet supported"; } } - # Find the ticket number for this intern. + my $completedInternshipField = GetCustomFieldForTicket($ticket, "completed-internship"); + if (not defined $completedInternshipField) { + print STDERR "\"$file\": \"$ticket\": Skipping: cannot determine Entity from ticket.\n" ; + next; + } elsif ($completedInternshipField eq 'successful') { + # Don't print to STDERR here, just keep a count since these are "old interns" + $oldInterns++; + next; + } my $entity = LedgerTagFromTicket($ticket, 'Entity'); if (not defined $entity) { print STDERR "\"$file\": \"$ticket\": Skipping: cannot determine Entity from ticket.\n" ; @@ -227,7 +238,6 @@ while (my $file = readdir $dh) { } next; } - my $completedInternshipField = GetCustomFieldForTicket($ticket, "completed-internship"); my $expectVal = 'payment-' . $prevPayNum . "-approved"; if ($completedInternshipField ne $expectVal) { print STDERR "\"$file\": \"$ticket\": Skipped: completed-internship field was ", @@ -258,6 +268,7 @@ while (my $file = readdir $dh) { next; } } +print STDERR "Old Interns, who were marked as successful (likely from previous interns) ignored: $oldInterns\n"; ############################################################################### # # Local variables: