63 lines
2.3 KiB
Text
63 lines
2.3 KiB
Text
|
#!/usr/bin/perl
|
||
|
# Copyright © 2018, Bradley M. Kuhn
|
||
|
# License: AGPL-3.0-or-later
|
||
|
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
|
||
|
use autodie qw(:all);
|
||
|
|
||
|
use Getopt::Long;
|
||
|
use File::Spec;
|
||
|
use Date::Manip qw(ParseDate UnixDate);
|
||
|
|
||
|
my($VERBOSE, $INTERACTIVE, $PAYMENT_NUMBER, $SVN_CMD, $ROUND);
|
||
|
|
||
|
our $RT_CMD;
|
||
|
require 'rt-helper.pl';
|
||
|
|
||
|
|
||
|
###############################################################################
|
||
|
|
||
|
GetOptions("verbose=i" => \$VERBOSE, "interactive" => \$INTERACTIVE,
|
||
|
"paymentNumber=i" => \$PAYMENT_NUMBER, "rtCommand=s" => \$RT_CMD,
|
||
|
"svnCommand=s" => \$SVN_CMD, "round=s" => \$ROUND);
|
||
|
|
||
|
$RT_CMD = '/usr/bin/rt' unless defined $RT_CMD;
|
||
|
$SVN_CMD = '/usr/bin/svn' unless defined $SVN_CMD;
|
||
|
|
||
|
$INTERACTIVE = 0 if not defined $INTERACTIVE;
|
||
|
|
||
|
unless (defined $ROUND and $ROUND =~ /^[\d\-]+$/) {
|
||
|
print STDERR "usage: $0 --round=<YEAR-MONTH> option is required and must formated as YYYY-MM\n";
|
||
|
exit 1;
|
||
|
}
|
||
|
unless (defined $PAYMENT_NUMBER and $PAYMENT_NUMBER =~ /^[123]$/) {
|
||
|
print STDERR "usage: $0 --paymentNumber=<VALUE> option is required and must be 1, 2 or 3\n";
|
||
|
exit 1;
|
||
|
}
|
||
|
|
||
|
my @ticketSpecs = Outreachy_FindMainTicketsInRound($ROUND);
|
||
|
my $expectedCompletedInternshipField = '(payment-' . $PAYMENT_NUMBER . '-approved|unsuccessful)';
|
||
|
$expectedCompletedInternshipField = 'success' if ($PAYMENT_NUMBER == 3);
|
||
|
foreach my $ticketSpec (@ticketSpecs) {
|
||
|
my $completedInternshipField = GetCustomFieldForTicket($ticketSpec, "completed-internship");
|
||
|
print "$ticketSpec : has completed-internship of $completedInternshipField instead of $expectedCompletedInternshipField\n" unless $completedInternshipField =~ /$expectedCompletedInternshipField/;
|
||
|
next if $completedInternshipField eq 'unsucessful';
|
||
|
|
||
|
my $status = GetStatusFromTicket($ticketSpec);
|
||
|
for my $ii (1 .. $PAYMENT_NUMBER) {
|
||
|
my $date = PaymentDateByTicket($ticketSpec, $ii);
|
||
|
print "$ticketSpec : payment $ii is not yet completed.\n" if (not defined $date)
|
||
|
and $ii < $PAYMENT_NUMBER;
|
||
|
print "$ticketSpec : payment $ii is not yet completed.\n" if (not defined $date)
|
||
|
and ($status =~ /entered|paid/) and ($ii == $PAYMENT_NUMBER);
|
||
|
}
|
||
|
}
|
||
|
###############################################################################
|
||
|
#
|
||
|
# Local variables:
|
||
|
# compile-command: "perl -c rt-outreachy-sanity-check.plx"
|
||
|
# perl-indent-level: 2
|
||
|
# End:
|