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