X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=bin%2Fmo-score;h=4dec3a11677f9106d694340be829cfb2a0c1f8fa;hb=c54cab5bbd5b7c4cb0a48e17257b0150b4ceea66;hp=c6eb1376c2fe9b29bd008a0c2f6d973410488f1c;hpb=04c2d74bd1a8f8c4203220ab70cc11ed215fd8d4;p=eval.git diff --git a/bin/mo-score b/bin/mo-score index c6eb137..4dec3a1 100755 --- a/bin/mo-score +++ b/bin/mo-score @@ -7,7 +7,7 @@ $tex = 0; $extras = 0; $alt = 0; $merged = 0; -$usage = "Usage: mo-score [--detail] [--alt] [--extras] [--html] [--tex] [--merged] ..."; +$usage = "Usage: mo-score [--detail] [--alt] [--extras] [--html] [--tex] [--merged] [/] ..."; while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) { shift @ARGV; $var = "\$$1"; @@ -16,8 +16,6 @@ while (($arg = $ARGV[0]) =~ /^--([a-z]+)$/) { } @ARGV || die $usage; -@tasks = @ARGV; - print STDERR "Scanning contestants... "; open (CT, "bin/mo-get-users --full |") || die "Cannot get list of contestants"; while () { @@ -44,16 +42,17 @@ if ($extras && open (EX, "exceptions")) { } else { print STDERR "none\n"; } print STDERR "Scanning task results... "; -$need_tasks = join("|", @ARGV); %messages = (); %error_codes = (); foreach $u (keys %users) { - opendir (D, "testing/$u") or next; - foreach $t (readdir(D)) { - $t =~ /^\./ && next; - $t =~ /$need_tasks/ || next; + foreach $task (@ARGV) { + my ($dir, $t) = ("testing", $task); + if ($task =~ m@^(.*)/([^/]*)$@) { + $dir = $1; + $t = $2; + } $known_tasks{$t} = 1; - $tt = "testing/$u/$t/points" . ($alt ? ".alt" : ""); + $tt = "$dir/$u/$t/points" . ($alt ? ".alt" : ""); -f $tt || next; print STDERR "$u/$t "; open (X, $tt) || die "Unable to open $tt"; @@ -99,7 +98,6 @@ foreach $u (keys %users) { $total{$u}{$t} = 0; foreach my $pts (values %{$results_merged{$u}{$t}}) { $total{$u}{$t} += $pts; } } - closedir D; } print STDERR "OK\n"; @@ -115,8 +113,11 @@ if (keys %extra) { push @bodysums, $col; push @footer, "sum($col)"; } -foreach $t (@ARGV) { +@tasks = (); +foreach $task (@ARGV) { + my $t = ($task =~ m@/([^/]*)$@) ? $1 : $task; defined $known_tasks{$t} || die "Unknown task $t"; + push @tasks, $t; push @header, substr($t, 0, 4); push @body, "(\$xx = \$total{\$u}{'$t'}) > 0 ? \$xx : 0"; $col = 0+@footer; @@ -243,7 +244,7 @@ sub printHtmlHeader { if ($detail) { $hdr1 = "RankUserName"; - $extras and $p++ and push @$perm, 3 and $hdr1.="Extra" and $colspec.=""; + $extras and $p++ and push @$perm, 3 and $hdr1.="Extra" and $colspec.=""; ##Extra hack for my $task (@tasks) { my $nSub = scalar(keys %{$known_tests{$task}}); @@ -264,7 +265,7 @@ sub printHtmlHeader { } else { ## no detail $hdr1 = "RankUserName"; - $extras and $p++ and push @$perm, 3 and $hdr1.="Extra" and $colspec.=""; + $extras and $p++ and push @$perm, 3 and $hdr1.="Extra" and $colspec.=""; ##Extra hack for my $task (@tasks) { push @$perm, $p++;