Commit 6c503819 authored by Robert Ricci's avatar Robert Ricci

Detect some more interesting cases

Look for 'in progress' grading, grades that are finished but not pushed,
and submissions that were graded by someone else.
parent 8cda03c3
#!/usr/bin/perl -w
use Time::Piece;
#
# Meanings of the flags at the end of the line:
# D: Done: graded locally, and local branch matches the remote one
# I: In progress: branch exists locally, but latest commit does not look like
# it contains a final score
# R: Ready to push: branch exists locally, and latest commit looks like it
# contains a final score
# S: Has been graded remotely, but not locally - someone else probably graded
# it
# X: Has been graded locally, remote branch exists but is different - something
# is probably wrong
die "Usage: $0 <hw>\n" unless (scalar(@ARGV) == 1);
my ($hw) = (@ARGV);
......@@ -29,6 +41,12 @@ foreach my $branch (@branches) {
if ($branch =~ /$hw-graded-(\w+)/) {
my $student = $1;
$students{$student}{graded} = get_date($branch);
## Check to see if we appear to be finished grading it or not
if (`git show -s --format=%s $branch` =~ /^\s*Total/) {
$students{$student}{'flag'} = "R";
} else {
$students{$student}{'flag'} = "I";
}
}
} elsif ($branch =~ /^remotes\/(\w+)\/([\w-]+)/) {
## Remote branch
......@@ -37,15 +55,21 @@ foreach my $branch (@branches) {
if ($remotebranch eq "$hw-submit") {
$students{$student}{submitted} = get_date($branch);
} elsif ($remotebranch eq "$hw-graded") {
## Check to see if the local branch matches the version that's
## been pushed up
if (`git rev-parse $branch` eq
`git rev-parse $hw-graded-$student`) {
## Yes, they are the same, we've pushed it up
$students{$student}{'flag'} = "O";
## Check to see if we have this locally, or if someone else did
## it - rely on the fact that local branches are printed first
if (!exists($students{$student}{graded})) {
$students{$student}{'flag'} = "S";
} else {
## No, they are not the same, we need to push
$students{$student}{'flag'} = "X";
## Check to see if the local branch matches the version that's
## been pushed up
if (`git rev-parse $branch` eq
`git rev-parse $hw-graded-$student`) {
## Yes, they are the same, we've pushed it up
$students{$student}{'flag'} = "D";
} else {
## No, they are not the same, we need to push
$students{$student}{'flag'} = "X";
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment