]> mj.ucw.cz Git - moe.git/commitdiff
Added a simple evaluation report utility.
authorMartin Mares <mj@ucw.cz>
Tue, 3 Jul 2007 11:55:31 +0000 (13:55 +0200)
committerMartin Mares <mj@ucw.cz>
Tue, 3 Jul 2007 11:55:31 +0000 (13:55 +0200)
bin/mo-report [new file with mode: 0755]

diff --git a/bin/mo-report b/bin/mo-report
new file mode 100755 (executable)
index 0000000..6272ccd
--- /dev/null
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use POSIX;
+
+foreach my $user (`cd testing && ls`) {
+       chomp $user;
+       print "$user:";
+       open REP, ">testing/$user/REPORT" or die;
+       print REP "Evaluation report for CEOI 2007 Day 1\n\n";
+       my $total = 0;
+       foreach my $task (@ARGV) {
+               print REP "### Task $task ###\n\n";
+               if (open PTS, "testing/$user/$task/points") {
+                       my $tt = 0;
+                       while (<PTS>) {
+                               chomp;
+                               my ($test, $pts, $comm) = /(\S+)\s+(\S+)\s+(.*)/;
+                               $comm =~ s/\.$//;
+                               printf REP "Test %2s: %2d points (%s)\n", $test, $pts, $comm;
+                               $tt += $pts;
+                       }
+                       close PTS;
+                       print REP "\nTOTAL: $tt points\n\n";
+                       $total += $tt;
+                       print " $tt";
+               } else {
+                       print REP "No solution submitted.\n\n";
+                       print " -";
+               }
+       }
+       print REP "### TOTAL FOR DAY 1 ###\n\n";
+       print REP "$total points\n";
+       print REP "\n\n(generated on ", strftime("%Y-%m-%d %H:%M:%S", localtime), ")\n";
+       close REP;
+       print " -> $total\n";
+}