[rochester] / trunk / rochester_problib / setSampleQuestionnaires / TA_evaluation / compile_TA_results_mth142_sp00.pl Repository:
ViewVC logotype

View of /trunk/rochester_problib/setSampleQuestionnaires/TA_evaluation/compile_TA_results_mth142_sp00.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (download) (as text) (annotate)
Mon Jun 25 19:20:51 2001 UTC (11 years, 10 months ago) by sam
File size: 21734 byte(s)
added problem library as webwork/ww_prob_lib with revision tag prob-lib-2

    1 #!/usr/bin/perl
    2 
    3 use strict;
    4 
    5 ##
    6 ## REVISION HISTORY
    7 ## A. Pizer (Rochester) June 2000
    8 ##
    9 ##
   10 ## This script parses results generated by TA_evaluation_142_spring00.pg and summarizes them
   11 ## into 4 files.  The orginal files have the format described at the end of this file.
   12 
   13 ## The the required inputs are the html source of the questionnaire, a file containing all the
   14 ## email responses concatenated into one file, and a base file name [e.g. TA_evalation_sp00]
   15 ## (without an extension) for the four output files [the four output files will be e.g.
   16 ## TA_evalation_sp00.html, TA_evalation_sp00_summary.html, TA_evalation_sp00.xls, and
   17 ## TA_evalation_sp00.txt].
   18 
   19 ## TA_evalation_sp00_summary.html is a small file containing a summary of the responses of question 5
   20 ## which is the overall evaluation.
   21 
   22 ## TA_evalation_sp00.html is a large file containing detailed information on each TA along with all
   23 ## student written comments. The comments are ordered in the approximate order of from better to worst.
   24 
   25 ## TA_evalation_sp00.xls is a large file suitable for importation to a spreadsheet program such as Excel.
   26 ## It contains all numerical data.
   27 
   28 ## TA_evalation_sp00.txt is a large file suitable for importation to a spreadsheet program such as Excel.
   29 ## It contains all written comments.  The numerical and written data are keyed to each other.
   30 
   31 
   32 
   33 
   34 my ($questionnaire,$filename,@data,%percent_results,%count_results,$question,$numeric,$standardOutput);
   35 my ($in, $psvn, $question_number, %question_response, %essay_response, $inpath,$TA_number);
   36 
   37 my $max_number_of_ans = 100;  ## among all questions, the one with the maximum possible number of answers
   38                              ## has at most the answers 0,1,2,3, ..., 100
   39 my @ans;
   40 my @c_ans;
   41 
   42 if(@ARGV==3){
   43     $questionnaire = $ARGV[0];
   44     $inpath = $ARGV[1];
   45     $filename = $ARGV[2];
   46 }else{
   47     print "\nNote: the following items can be supplied as command line arguments.\n
   48 (i.e. compile_TA_results_mth142_sp00.pl  questionnaire.html  raw_data.txt  mth142_results\n";
   49     print "\nQuestionnaire HTML file is: ";
   50     chomp($questionnaire = <STDIN>);
   51     print "\nFile of email responses to questionnaire.pg is: ";
   52     chomp($inpath = <STDIN>);
   53     print "\nYou need to enter base file name (without an extension) to use for the output files.\n";
   54     print "   For example, if the base file name is TA_results, the output files will be\n";
   55     print "   TA_results.html, TA_results.xls, and TA_results.txt\n";
   56     print "Enter the base file name: ";
   57     chomp($filename = <STDIN>);
   58 };
   59 
   60 my $outfile  = "$filename".'.html'; ## html file summarizing responses with comments
   61 my $outpath1 = "$filename".'.xls';  ## tab delimited file of non essay responses
   62 my $outpath2 = "$filename".'.txt';  ## essay responses (question 6)
   63 my $outpath3  = "$filename".'_summary.html'; ## small html file summarizing overall evaluation
   64 
   65 # Get the list of recitations from the questionnaire
   66 # This is the list of numbers associated to recitations in question B
   67 
   68 open(QUESTIONNAIRE, "<$questionnaire")||die "Can't read questionnaire $questionnaire, $!";
   69 
   70 my %TA_name_hash = ();
   71 my  ($line,$mode);
   72 
   73 ## get mode
   74 while($line = <QUESTIONNAIRE>){
   75     next unless ($line =~ /Mode=([^&]*)/);
   76     $mode = $1;
   77     last;
   78 }
   79 
   80 if ($mode eq 'Latex2HTML') {
   81     while($line = <QUESTIONNAIRE>){
   82         next unless ($line =~ /NAME="AnSwEr2"/);
   83     ## line looks like   <OL TYPE="A" VALUE="A">   <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="1" >Micah Milinovich,  Monday     6:15-7:05 PM   in Hylan 105    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="2" >Hongkun Wang,      Monday     6:40-7:30 PM   in Hylan 202    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="3" >Tao Cui,           Tuesday    12:30-1:20 PM  in Hylan 202    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="4" >Harish Nataraj,    Tuesday    5:00-5:50 PM   in Hylan 1101    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="5" >Kristy Brown,      Tuesday    6:15-7:05 PM   in Hylan 202    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="6" >Gang Liu,          Tuesday    6:15-7:05 PM   in Hylan 206    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="7" >Tao Cui,           Wednesday  9:00-9:50 AM   in Hylan 307    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="8" >Ozge Uluckan,      Wednesday  11:00-11:50 AM in Hylan 105    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="9" >Hongkun Wang,      Wednesday  11:00-11:50 AM in Hylan 206    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="10" >Brad Krauz,        Wednesday  11:00-11:50 AM in Hylan 203    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="11" >Courtney Pederson, Thursday   10:00-10:50 AM in Hylan 1101    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="12" >Tao Cui,           Thursday   12:30-1:20 PM  in Hylan 202    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="13" >Hongkun Wang,      Friday     11:00-11:50 AM in Hylan 201    <LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="0" >none    </OL>
   84         chomp($line);
   85         $line =~ s/^.*?INPUT/<INPUT/; #remove begining
   86         $line =~ s!</OL>\s*$!!; #remove ending
   87         $line =~ s/INPUT TYPE=RADIO NAME="AnSwEr2" VALUE=//g;
   88         $line =~ s/"//g;
   89     ## line now looks like  <1 >Micah Milinovich,  Monday     6:15-7:05 PM   in Hylan 105    <LI> <2 >Hongkun Wang,      Monday     6:40-7:30 PM   in Hylan 202    <LI> <3 >Tao Cui,           Tuesday    12:30-1:20 PM  in Hylan 202    <LI> <4 >Harish Nataraj,    Tuesday    5:00-5:50 PM   in Hylan 1101    <LI> <5 >Kristy Brown,      Tuesday    6:15-7:05 PM   in Hylan 202    <LI> <6 >Gang Liu,          Tuesday    6:15-7:05 PM   in Hylan 206    <LI> <7 >Tao Cui,           Wednesday  9:00-9:50 AM   in Hylan 307    <LI> <8 >Ozge Uluckan,      Wednesday  11:00-11:50 AM in Hylan 105    <LI> <9 >Hongkun Wang,      Wednesday  11:00-11:50 AM in Hylan 206    <LI> <10 >Brad Krauz,        Wednesday  11:00-11:50 AM in Hylan 203    <LI> <11 >Courtney Pederson, Thursday   10:00-10:50 AM in Hylan 1101    <LI> <12 >Tao Cui,           Thursday   12:30-1:20 PM  in Hylan 202    <LI> <13 >Hongkun Wang,      Friday     11:00-11:50 AM in Hylan 201    <LI> <0 >none
   90         my @data_array = split /<LI>/, $line;
   91         my $entry;
   92         foreach $entry (@data_array) {
   93             $entry =~ /^\s*<(\d+)\s*>(.*)$/;
   94             $TA_name_hash{$1}=$2;
   95         }
   96         last;
   97     }
   98 }
   99 else {  ## text or tth mode
  100     while($line = <QUESTIONNAIRE>){
  101     next unless ($line =~ /NAME="AnSwEr2"/);
  102     ## lines looks like
  103 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="1" >Usman Alim,       Thur 6:15-7:15  in Hylan 206
  104 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="2" >Candace Gildner,  Fri 11:00-11:50 in B&L 269
  105 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="3" >Zokrab Moustafaev,Tue 12:30-1:20  in Meliora 221
  106 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="4" >Iulian Obreja,    Wed 9:00-9:50   in Hutchison 339
  107 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="5" >Iulian Obreja,    Wed 12:00-12:50 in Hylan 101
  108 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="6" >Iulian Obreja,    Tue 4:50-5:40   in Hylan 105
  109 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="7" >Diana Pang,       Mon 1:00-1:50   in Hutchison 138
  110 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="8" >Cory Rubin,       Wed 11:00-11:50 in B&L 315
  111 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="9" >Wan Tang,         Wed 4:50-5:40   in Hylan 1104
  112 #<LI> <INPUT TYPE=RADIO NAME="AnSwEr2" VALUE="0" >None
  113     chomp($line);
  114     $line =~ /^.*?VALUE="(\d+)"\s*>(.*)/;
  115     $TA_name_hash{$1}=$2;
  116     }
  117 }
  118 
  119 close(QUESTIONNAIRE);
  120 
  121 sub numerically {$a <=> $b; }
  122 my @TA_number_array = sort numerically keys %TA_name_hash;
  123 
  124 ## Order the TA's so that all of a TA's recitations are grouped together
  125 ## The order comes from the html source of the questionnaire
  126 @TA_number_array = (1,2,3,4,5,6,7,8,9);
  127 
  128 open(STDIN, "<$inpath") or die "Can't read  file at: $inpath";
  129 
  130 print "Reading input from $inpath\n";
  131 my $counter=0;
  132 
  133 my %psvn_hash = ();
  134 my %histogram = ();
  135 
  136 while (<>) {
  137     $in = $_;
  138     # skip blank lines
  139     next unless $in =~ /\S/;
  140     # skip other lines
  141     next if $in =~/Delivered-To:|To:|X-Remote-Host:|Subject:|Date:|From:/;
  142     if ( $in =~ /^\s*(\d+)\-Problem\-\d\-Question\-([^\:]+):/  ) {
  143         $psvn = $1;
  144         $question_number = $2;
  145         $psvn_hash{$psvn}++;
  146         $counter++;
  147     } else {
  148         # text line
  149         chomp($in);
  150         $in =strip_spaces($in);
  151         if ( $question_number =~/B/ ) {$TA_number = $in;}    # get TA_number
  152         if ( $question_number =~/6/ ) {
  153             # essay responses are accumulated
  154             my $label = "$psvn - $question_number";
  155             $essay_response{$TA_number}{$label} .= $in;
  156         }
  157         else {
  158            # a new record entry is defined, unless a non-blank one has already been defined.
  159            # this means that the first non-blank or non-zero response is recorded.
  160            $question_response{"$psvn - $question_number"} = $in unless defined($question_response{"$psvn - $question_number"} and $question_response{"$psvn $question_number"} =~ /\S/);
  161         }
  162     }
  163 }
  164 close(STDIN);
  165 print "\n\n$counter Questions processed ";
  166 print "from ",scalar(keys %psvn_hash), " students\n";
  167 
  168 
  169 open(OUT1, ">$outpath1") or die "Can't write to file at: $outpath1";
  170 open(OUT2, ">$outpath2") or die "Can't write to file at: $outpath2";
  171 
  172 
  173 my ($key, $key1, $key2, $key3, %count);
  174 
  175 # order (keys %psvn_hash) by the response to question 5.  Doing so will approximately order the
  176 # essay responses from good to bad.
  177 
  178 sub by_question5 {
  179     $question_response{"$b - 5"} <=> $question_response{"$a - 5"};
  180 }
  181 
  182 my @sorted_psvn_keys = sort by_question5 keys %psvn_hash;
  183 
  184 # This is the list of question numbers in the order you want them printed out to the tab separated Excel file.
  185  my @key_list = qw (A B C 1 2 3 4 5);
  186 # Print the header for the excel file;
  187 
  188 print OUT1 "\t",join("\t",@key_list ),"\tnumber of replies", "\n";
  189 
  190 foreach my $key (@sorted_psvn_keys) {
  191      print OUT1 "$key\t";  # print the psvn key
  192              foreach my $key2 (  @key_list ) {
  193                 my $label = "$key - $key2";
  194                  print OUT1 $question_response{$label}  if defined $question_response{$label};
  195                  print OUT1 "\t";
  196                  if ($question_response{$label} =~ /[0-9]+/){
  197                     $key3 = $question_response{"$key - B"};
  198                     $histogram{$key3}{$key2}[$question_response{$label}]++;
  199                     $count{$key3}{$key2}++;
  200                  };
  201      }
  202      print OUT1 "$psvn_hash{$key}\n";  # record the number of responses
  203 }
  204 close(OUT1);
  205 
  206 
  207 foreach $TA_number (@TA_number_array) {
  208     foreach  $key2 ( @key_list ) {
  209 
  210         if ( defined $histogram{$TA_number}{$key2}) {
  211             my $i=0;
  212             my $j=0;
  213             my $val;
  214 
  215             while( @{$histogram{$TA_number}{$key2}} ){
  216                 $val = shift(@{$histogram{$TA_number}{$key2}});
  217                 $percent_results{$TA_number}{$key2}[$i++]= sprintf("%.1f",$val/$count{$TA_number}{$key2}*100);
  218                 $count_results{$TA_number}{$key2}[$j++]= $val;
  219             };
  220         };
  221     };
  222 }
  223 my @questions = qw (6);
  224 my $response;
  225 
  226 foreach $TA_number (@TA_number_array) {
  227     print OUT2 "\n\n\n $TA_name_hash{$TA_number}";
  228     foreach  $key2 (@questions) {
  229         print OUT2 "\n\nQuestion: $key2\n\n";
  230         foreach  $key (@sorted_psvn_keys) {
  231             if (defined $essay_response{$TA_number}{"$key - $key2"})
  232              {
  233                 my $label="$key - $key2";
  234 #                print "psvn:$key\n\t";
  235                 print OUT2 "psvn:$key\n\t";
  236 # print "response for |${TA_number}| and |${label}| is \n $essay_response{$TA_number}{$label}\n";
  237                 print  OUT2 "$essay_response{$TA_number}{$label}\n";
  238             }
  239         }
  240         print OUT2 "\n";
  241     }
  242 }
  243 close(OUT2);
  244 print "Questionnaire processed\n";
  245 
  246 
  247 foreach $TA_number (@TA_number_array) {
  248     open(QUESTIONNAIRE, "<$questionnaire")||die "Can't read questionnaire $questionnaire, $!";
  249   open(OUT, ">>$outfile")||die "Can't write to $outfile, $!";
  250 
  251   while(<QUESTIONNAIRE>){
  252       $line =$_;
  253       last if $line =~ /^<TEXTAREA/;
  254       if($line =~ /^Dear Students/) {
  255           print OUT '<H1>';
  256           print OUT "$TA_name_hash{$TA_number}";
  257           print OUT '</H1>';
  258       }
  259     print OUT $line unless $line =~ /^\s*<HR>/;
  260       if($line =~ /^([A-Z])\./){$question = $1};
  261       if($line =~ /^(\d+)\./){$numeric = $1};
  262       next unless ($line =~ /^\s*<HR>/ or $line =~ /^\d+\./);
  263       if ($line =~ /^\s*<HR>/) {
  264 
  265           print_letter_out(\@{$count_results{$TA_number}{$question}},\@{$percent_results{$TA_number}{$question}},\%{$count{$TA_number}});
  266           print OUT "\n<HR>\n";
  267 
  268           if ($question eq 'A') {         ## skip question B --- list of TA's
  269               print OUT "\nSkipping question B which lists TA's and recitations.\n";
  270               print OUT "\n<HR>\n";
  271 
  272 LINE:         while(<QUESTIONNAIRE>) {
  273                   $line =$_;
  274                   next LINE unless $line =~ /^\s*<HR>/ ;
  275                   last LINE if $line =~ /^\s*<HR>/ ;
  276               }
  277             }
  278     }
  279     elsif (!($numeric eq '6')and defined @{$percent_results{$TA_number}{$numeric}} ) {
  280 
  281       @ans = @{$percent_results{$TA_number}{$numeric}};
  282       @c_ans = @{$count_results{$TA_number}{$numeric}};
  283       my $i;
  284             for ($i = 0; $i <6; $i++) {
  285                 $c_ans[$i] = 0 unless defined $c_ans[$i];
  286             }
  287       print OUT "\n</TD><TD>\n";
  288       $standardOutput = select OUT; #switch default output file handle to OUT
  289                 $~ = "NUMERICOUT"; # switch format for OUT to NUMERICOUT
  290                  write;
  291     $~ = "OUT";  # restore format for OUT
  292        select($standardOutput); # restore default file handle for output
  293       }
  294       elsif (!($numeric eq '6')) {} ## do nothing
  295       else {  ## print out essay responses
  296           print  OUT '<p><p>';
  297             foreach  $key2 (@questions) {
  298                 foreach  $key (@sorted_psvn_keys) {
  299                     if (defined $essay_response{$TA_number}{"$key - $key2"})
  300                         {
  301                         my $label="$key - $key2";
  302                         print  OUT "$essay_response{$TA_number}{$label}<p><p>";
  303                     }
  304                 }
  305                 print OUT '<p> <p>';
  306             }
  307         }
  308     }
  309     close(QUESTIONNAIRE)||die "Can't close questionnaire $questionnaire, $!";
  310 
  311 }
  312 close(OUT)||die "Can't close the output file $outfile, $!";
  313 
  314 ## produce a summary of the results of the overall evaluation
  315 
  316 my %TA_recitations;     ## a hash of arrays. For each TA name, we list all his or her recitations
  317 my $TA_name;
  318 
  319 foreach $TA_number (keys %TA_name_hash) {
  320     $TA_name = $TA_name_hash{$TA_number};
  321     $TA_name =~ s/,.*//;  ## just keep name
  322     $TA_name =~ s/\s*$//; ## remove trailing spaces
  323     push @{ $TA_recitations{$TA_name} }, $TA_number;
  324 }
  325 
  326 my (%last_name,$last_name);
  327 foreach $TA_name (keys %TA_recitations) {
  328     $TA_name =~ m!(\S*)$!;
  329     $last_name{$TA_name} = $1;
  330 }
  331 
  332 sub by_last_name { $last_name{$a} cmp $last_name{$b};  }
  333 
  334 my %summary;            ## a hash of arrays. For each TA name, we list # of recitations, # of responses
  335                         ## avg. of overall evaluations (among non zero responses), and number of responses
  336                         ## that are 5's, 4's, etc.
  337 
  338 my ($avg,$non_zero_count, @total_c_ans, $total_count, $num_of_recitations, $i);
  339 
  340 foreach $TA_name (sort by_last_name keys %TA_recitations) {
  341     $avg = 0;
  342     $non_zero_count = 0;
  343     $total_count = 0;
  344     $num_of_recitations = 0;
  345     for ($i=0; $i <= 5; $i++) {$total_c_ans[$i] = 0;}
  346     foreach $TA_number (@{ $TA_recitations{$TA_name} }) {
  347         $num_of_recitations++;
  348 #@c_ans = @{$count_results{$TA_number}{'5'}};   ## results from over all evaluation
  349         for ($i=0; $i <= 5; $i++) {
  350             $total_c_ans[$i] += $count_results{$TA_number}{'5'}[$i];
  351         }
  352 #for ($i=0; $i <= 5; $i++) {$total_c_ans[$i] += $c_ans[$i];}
  353         $total_count += $count{$TA_number}{'5'};
  354     }
  355     for ($i=1; $i <= 5; $i++) {$non_zero_count += $total_c_ans[$i];}
  356     for ($i=1; $i <= 5; $i++) {$avg += $i*$total_c_ans[$i];}
  357     if ($non_zero_count > 0) {
  358         $avg = sprintf("%.2f",$avg/$non_zero_count);
  359     }
  360     else {$avg = 0};
  361     push @{ $summary{$TA_name} }, $num_of_recitations, $total_count,$avg, reverse @total_c_ans;
  362 }
  363 
  364 open(OUT3, ">$outpath3") or die "Can't write to file at: $outpath1";
  365 
  366 print OUT3 <<EOT;
  367 <HTML>
  368 
  369 <HEAD>
  370 <TITLE>
  371    Spring 2000 Summary of student TA evaluations
  372 </TITLE>
  373 </HEAD>
  374 
  375 <BODY BGCOLOR="#FFFFFF">
  376 
  377 <BR CLEAR=ALL>
  378 
  379 <H1>Spring 2000 Summary of student TA evaluations</H1>
  380 <H2>Results from the overall evaluation question No. 5</H2>
  381 <H3>avg is the average for all non zero responses </H3>
  382 
  383 <TABLE BORDER> <tr ALIGN=CENTER> <td> T A </td> <td> recitations </td><td>students </td><td>avg </td><td> 5's </td><td> 4's </td><td> 3's </td><td> 2's </td><td> 1's </td><td>0's </td></tr>
  384 EOT
  385 
  386 foreach $TA_name (sort by_last_name keys %TA_recitations) {
  387     next if $TA_name eq 'None';
  388     print  OUT3  "\n <tr ALIGN=CENTER> <td>$TA_name </td>";
  389     for ($i=0; $i <=8; $i++) {
  390         print  OUT3  "<td> $summary{$TA_name}[$i] </td>";
  391     }
  392     print OUT3 "</td></tr>\n";
  393 }
  394 
  395 ## now handle the "None" case
  396     $TA_name = 'None';
  397     print  OUT3  "\n <tr ALIGN=CENTER> <td>$TA_name </td>";
  398     for ($i=0; $i <=8; $i++) {
  399         print  OUT3  "<td> $summary{$TA_name}[$i] </td>";
  400     }
  401     print OUT3 "</td></tr>\n";
  402 
  403 print OUT3 "\n </TABLE>";
  404 close (OUT3);
  405 
  406 print "\nhtml full data including comments sent to $outfile\n";
  407 print "html summary data sent to file $outpath3\n";
  408 print "Excel output sent to file $outpath1\n";
  409 print "Essay questions sent to file $outpath2\n";
  410 
  411 
  412 
  413 sub print_letter_out {
  414     my ($c_ans_ref, $ans_ref, $count_ref) = @_;
  415     my %count = %$count_ref;
  416 #    my ($c_ans0, $c_ans1, $c_ans2, $c_ans3, $c_ans4, $c_ans5,$c_ans6,$c_ans7,$c_ans8,$c_ans9,$c_ans10, $c_ans11, $c_ans12, $c_ans13) = @$c_ans_ref;
  417 #    my ($ans0, $ans1, $ans2, $ans3, $ans4, $ans5,$ans6,$ans7,$ans8,$ans9,$ans10, $ans11, $ans12, $ans13) = @$ans_ref;
  418     my @c_ans = @$c_ans_ref;
  419     my @ans = @$ans_ref;
  420 
  421     print OUT '<TABLE BORDER> <tr ALIGN=CENTER> <td> Answer </td> <td> Count </td><td> Percent </td></tr>';
  422     my $i;
  423     my @alphabet = ('0', 'A' .. 'Z');  ## element 1 is A
  424     for ($i = 1; $i <= $max_number_of_ans; $i++) {
  425         if (defined $c_ans[$i]) {
  426         print OUT "<tr ALIGN=CENTER> <td> $alphabet[$i] </td> <td> $c_ans[$i] </td><td> $ans[$i] </td></tr>";
  427         }
  428     }
  429 #    if (defined $c_ans2) {
  430 #        print OUT "<tr ALIGN=CENTER> <td> B </td> <td> $c_ans2 </td><td> $ans2 </td></tr>";
  431 #    }
  432 #    if (defined $c_ans3) {
  433 #        print OUT "<tr ALIGN=CENTER> <td> C </td> <td> $c_ans3 </td><td> $ans3 </td></tr>";
  434 #    }
  435 #    if (defined $c_ans4) {
  436 #        print OUT "<tr ALIGN=CENTER> <td> D </td> <td> $c_ans4 </td><td> $ans4 </td></tr>";
  437 #    }
  438 #    if (defined $c_ans5) {
  439 #        print OUT "<tr ALIGN=CENTER> <td> E </td> <td> $c_ans5 </td><td> $ans5 </td></tr>";
  440 #    }
  441 #    if (defined $c_ans6) {
  442 #        print OUT "<tr ALIGN=CENTER> <td> F </td> <td> $c_ans6 </td><td> $ans6 </td></tr>";
  443 #    }
  444 #    if (defined $c_ans7) {
  445 #        print OUT "<tr ALIGN=CENTER> <td> G </td> <td> $c_ans7 </td><td> $ans7 </td></tr>";
  446 #    }
  447 #    if (defined $c_ans8) {
  448 #        print OUT "<tr ALIGN=CENTER> <td> H </td> <td> $c_ans8 </td><td> $ans8 </td></tr>";
  449 #    }
  450 #    if (defined $c_ans9) {
  451 #        print OUT "<tr ALIGN=CENTER> <td> D </td> <td> $c_ans9 </td><td> $ans9 </td></tr>";
  452 #    }
  453 #    if (defined $c_ans10) {
  454 #        print OUT "<tr ALIGN=CENTER> <td> E </td> <td> $c_ans10 </td><td> $ans10 </td></tr>";
  455 #    }
  456 #    if (defined $c_ans11) {
  457 #        print OUT "<tr ALIGN=CENTER> <td> F </td> <td> $c_ans11 </td><td> $ans11 </td></tr>";
  458 #    }
  459 #    if (defined $c_ans12) {
  460 #        print OUT "<tr ALIGN=CENTER> <td> G </td> <td> $c_ans12 </td><td> $ans12 </td></tr>";
  461 #    }
  462 #    if (defined $c_ans13) {
  463 #        print OUT "<tr ALIGN=CENTER> <td> H </td> <td> $c_ans13 </td><td> $ans13 </td></tr>";
  464 #    }
  465     if (defined $c_ans[0]) {
  466         print OUT "<tr ALIGN=CENTER> <td> other </td> <td> $c_ans[0] </td><td> $ans[0] </td></tr>";
  467     }
  468 
  469     print OUT "<tr ALIGN=CENTER> <td> Total </td> <td> $count{$question} </td><td> 100 </td></tr>\n
  470           </TABLE>";
  471 }
  472 
  473 
  474 
  475 format NUMERICOUT =
  476 <TABLE BORDER> <tr ALIGN=CENTER> <td> Answer </td> <td> Count </td> <td> Percent </td></tr>
  477 <tr ALIGN=CENTER> <td> 5 </td> <td> @>>>> </td> <td> @>>> </td></tr>
  478                   $c_ans[5],  $ans[5]
  479 <tr ALIGN=CENTER> <td> 4 </td> <td> @>>>> </td> <td> @>>> </td></tr>
  480                    $c_ans[4], $ans[4]
  481 <tr ALIGN=CENTER> <td> 3 </td> <td> @>>>> </td> <td> @>>> </td></tr>
  482                   $c_ans[3],  $ans[3]
  483 <tr ALIGN=CENTER> <td> 2 </td> <td> @>>>> </td> <td> @>>> </td></tr>
  484                     $c_ans[2],$ans[2]
  485 <tr ALIGN=CENTER> <td> 1 </td> <td> @>>>> </td> <td> @>>> </td></tr>
  486                     $c_ans[1],$ans[1]
  487 <tr ALIGN=CENTER> <td> 0 </td> <td> @>>>> </td> <td> @>>> </td></tr>
  488                   $c_ans[0], $ans[0]
  489 <tr ALIGN=CENTER> <td> Total </td> <td> @>>>> </td><td> 100 </td></tr>
  490                                        $count{$TA_number}{$numeric}
  491 </TABLE>
  492 .
  493 
  494 
  495 
  496 
  497 sub strip_spaces {
  498     my $in = shift;
  499     $in =~ s/^\s*//;
  500     $in =~ s/\s*$//;
  501     $in;
  502 }
  503 
  504 #Format being read:
  505 
  506 #Delivered-To: apizer@math.rochester.edu
  507 #To: apizer@math.rochester.edu
  508 #X-Remote-Host:  unknown host(128.151.94.49)
  509 #Subject: mth142 TA evaluation
  510 #Date: Sat, 29 Apr 2000 02:52:07 -0400 (EDT)
  511 #From: webmaster@math.rochester.edu
  512 #
  513 #
  514 #
  515 #10475-Problem-2-Question-A:
  516 # 1
  517 #10475-Problem-2-Question-B:
  518 # 6
  519 #10475-Problem-2-Question-C:
  520 # 1
  521 #10475-Problem-2-Question-1:
  522 # 3
  523 #10475-Problem-2-Question-2:
  524 # 3
  525 #10475-Problem-2-Question-3:
  526 # 3
  527 #10475-Problem-2-Question-4:
  528 # 3
  529 #10475-Problem-2-Question-5:
  530 # 3
  531 #10475-Problem-2-Question-6:
  532 # Gives good alternative examples. A nice guy.

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9