Commit 19d9ac89 authored by Robert Ricci's avatar Robert Ricci

Add a mode in which we create and commit score files

parent 57ec8656
......@@ -67,23 +67,46 @@ if ($allstudents[0] > $allstudents[1] + $threshold) {
print "Top score is $topscore\n";
my $makescorefile = 1;
foreach my $student (sort keys %scores) {
print "##### $student\n";
my $FH;
if ($makescorefile) {
system "checkout-homework total $student\n";
open($FH,">score.txt");
} else {
$FH = *STDOUT;
}
my @studentscores = ();
foreach my $type (sort keys $scores{$student}) {
my ($typetotal, $typepossible) =
sum_pairs(values $scores{$student}{$type});
my $pct = $typetotal / $typepossible;
my $weight = $weights{$type};
printf "\t%13s: %6.2f / %6.2f (%3.2f) (%5.2f%% of grade)\n", $type,
printf $FH "\t%13s: %6.2f / %6.2f (%3.2f) (%5.2f%% of grade)\n", $type,
$typetotal, $typepossible, $pct, $weight*100;
push @studentscores, $pct * $weight;
foreach my $hw (sort keys $scores{$student}{$type}) {
my ($total, $possible, $hash) = @{$scores{$student}{$type}{$hw}};
printf $FH "\t\t%15s: %3d / %3d (%s)\n", $hw, $total, $possible, $hash;
}
print $FH "\n";
}
my $studenttotal = reduce { $a + $b } @studentscores;
printf "\t%13s: % 6.2f%%\n", "RAW TOTAL", $studenttotal*100;
printf $FH "\t%13s: % 6.2f%%\n", "RAW TOTAL", $studenttotal*100;
my $adjusted = $studenttotal / $topscore;
printf "\t%13s: % 6.2f%%\n", "ADJ. TOTAL", $adjusted*100;
printf "\t%13s: %s\n", "GRADE", get_lettergrade($adjusted);
printf $FH "\t%13s: % 6.2f%%\n", "ADJ. TOTAL", $adjusted*100;
printf $FH "\t%13s: %s\n", "GRADE", get_lettergrade($adjusted);
if ($makescorefile) {
close $FH;
system "git add score.txt";
system sprintf("git commit -m 'Total score: %.2f - grade %s'",$adjusted*100,get_lettergrade($adjusted));
}
}
sub get_grade_for($$) {
......
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