version 1.1, 2002/02/04 15:44:51
|
version 1.2, 2002/02/04 16:23:23
|
Line 9
|
Line 9
|
use Getopt::Std; |
use Getopt::Std; |
|
|
$usage = 'createtable.pl $Revision$, $Date$'. "\n". |
$usage = 'createtable.pl $Revision$, $Date$'. "\n". |
"Usage: createtable.pl [-d] [-t answers_file] [-m mail_file] [-o results] \n"; |
"Usage: createtable.pl [-d] [-s] [-t answers_file] [-m mail_file] [-o results] \n"; |
|
|
require 'parameters.pl'; |
require 'parameters.pl'; |
require 'subroutines.pl'; |
require 'subroutines.pl'; |
|
|
die $usage unless getopts('t:m:o:d'); |
die $usage unless getopts('t:m:o:ds'); |
|
|
$DEBUG=$opt_d; |
$DEBUG=$opt_d; |
|
$SHORT=$opt_s; |
|
|
my %teams; |
my %teams; |
my @answers; |
my @answers; |
Line 67 if ($opt_o)
|
Line 68 if ($opt_o)
|
# |
# |
# Печатаем заголовок |
# Печатаем заголовок |
# |
# |
printf "%5s", "N"; |
printf "%5s ", "N"; |
for ($i=1;$i<=$MAXQUEST;$i++) |
for ($i=1;$i<=$MAXQUEST;$i++) |
{ |
{ |
printf "%3d",$i; |
if ($SHORT) { |
|
printf("%1d",$i%10); |
|
} else { |
|
printf "%3d",$i; |
|
} |
} |
} |
printf "%3s","О"; |
printf "%3s","О"; |
printf "%4s","Р"; |
printf "%4s","Р"; |
Line 87 foreach $team (sort
|
Line 92 foreach $team (sort
|
} keys %teams |
} keys %teams |
) |
) |
{ |
{ |
printf "%5d",$teams{$team}->{regnum}; |
printf "%5d ",$teams{$team}->{regnum}; |
for ($i=1;$i<=$MAXQUEST;$i++) |
for ($i=1;$i<=$MAXQUEST;$i++) |
{ |
{ |
my $answer = $teams{$team}->{answers}[$i]; |
my $answer = $teams{$team}->{answers}[$i]; |
my $score = $answers[$i]->{$answer}->{score}; |
my $score = $answers[$i]->{$answer}->{score}; |
$score = '-' unless $score; |
$score = '-' unless $score; |
|
if ($SHORT) { |
|
printf "%1s",$score; |
|
} else { |
printf "%3s", $score; |
printf "%3s", $score; |
|
} |
} |
} |
printf "%3s",$teams{$team}->{score}; |
printf "%3s",$teams{$team}->{score}; |
printf "%4s",$teams{$team}->{rating}; |
printf "%4s",$teams{$team}->{rating}; |
Line 104 foreach $team (sort
|
Line 113 foreach $team (sort
|
# Печатаем последнюю строку таблицы |
# Печатаем последнюю строку таблицы |
# в ней рейтинги вопросов |
# в ней рейтинги вопросов |
# |
# |
printf "%5s", "Р"; |
if ($SHORT) { |
for ($i=1; $i<=$MAXQUEST;$i++) |
print "Рейтинг\n"; |
{ |
for ($j=0;$j<$MAXQUEST/12;$j++) { |
|
my $max=$j*12+12; |
|
if ($max>$MAXQUEST) { |
|
$max=$MAXQUEST; |
|
} |
|
for ($i=$j*12+1;$i<=$max;$i++){ |
|
printf("%3s",$i); |
|
} |
|
printf "\n"; |
|
for ($i=1+$j*12;$i<=$max;$i++){ |
|
printf("%3s",$ratings[$i]); |
|
} |
|
printf "\n"; |
|
} |
|
} else { |
|
printf "%5s ", "Р"; |
|
for ($i=1; $i<=$MAXQUEST;$i++) |
|
{ |
printf "%3s", $ratings[$i]; |
printf "%3s", $ratings[$i]; |
|
} |
|
print "\n"; |
} |
} |
print "\n"; |
|
|
|