X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=mop%2Feval%2Fmo-score.sh;h=b893d7623b6128c6ba557d8dbefca0b81b0c6731;hb=ecad15c02b1e1f64cd866016c50b172409e25b9f;hp=9ed73f4a2cb8f144a08d2330dea88553f550ea97;hpb=b6013d244489aca80a904755ec2531874361185c;p=moe.git diff --git a/mop/eval/mo-score.sh b/mop/eval/mo-score.sh index 9ed73f4..b893d76 100755 --- a/mop/eval/mo-score.sh +++ b/mop/eval/mo-score.sh @@ -8,7 +8,8 @@ $tex = 0; $extras = 0; $alt = 0; $merged = 0; -$usage = "Usage: mo-score [--detail] [--alt] [--extras] [--html] [--tex] [--merged] [/] ..."; +$table = 0; +$usage = "Usage: mo-score [--detail] [--alt] [--extras] [--html] [--tex] [--table] [--merged] [/] ..."; while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) { shift @ARGV; $var = "\$$1"; @@ -17,6 +18,12 @@ while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) { } @ARGV || die $usage; +$print_key = 1; +if ($table) { + open STDOUT, "|column -t -s'\t'" or die; + $print_key = 0; +} + print STDERR "Scanning contestants... "; open (CT, "bin/mo-get-users --full |") || die "Cannot get list of contestants"; while () { @@ -75,6 +82,8 @@ foreach $u (keys %users) { elsif ($trem =~ /^Caught fatal signal /) { $cmt = "SG"; } elsif ($trem =~ /^([A-Za-z])\S*\s+([A-Za-z])/) { ($cmt = "$1$2") =~ tr/a-z/A-Z/; + } elsif ($trem =~ /^([A-Za-z]{2})/) { + ($cmt = $1) =~ tr/a-z/A-Z/; } if (!defined $messages{$trem}) { $messages{$trem} = $cmt; @@ -178,7 +187,7 @@ while ($i < @table) { } else { ${table[$j]}[0] = $j+1 . ".-" . $i . "."; $j++; - while ($j < $i) { ${table[$j++]}[0] = ""; }; + while ($j < $i) { ${table[$j++]}[0] = " "; }; } } print STDERR "OK\n"; @@ -219,11 +228,12 @@ if ($debug) { print "\\error{TeX output not supported yet!}\n"; } else { foreach $r (@table) { print join("\t",@$r), "\n"; } - print "\n"; - foreach $r (sort keys %error_codes) { print "$r: $error_codes{$r}\n"; } + if ($print_key) { + print "\n"; + foreach $r (sort keys %error_codes) { print "$r: $error_codes{$r}\n"; } + } } - sub printHtmlRow { print "", join('',map { if ($hdr) { $_ = "$_"; } @@ -231,7 +241,6 @@ sub printHtmlRow { } @_), "\n"; } - sub printHtmlHeader { my ($perm) = @_;