[system] / trunk / webwork / system / cgi / cgi-scripts / profCourseRecData.pl Repository:
ViewVC logotype

View of /trunk/webwork/system/cgi/cgi-scripts/profCourseRecData.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (download) (as text) (annotate)
Mon Jun 18 15:21:51 2001 UTC (11 years, 11 months ago) by sam
File size: 23542 byte(s)
another setup script test (changed #! lines)

    1 #!/usr/local/bin/webwork-perl
    2 
    3 ## This file is profCourseRecData.pl
    4 ## It displays overall data on how students in various recitations
    5 ## are doing on problems. E.g. the instructor can spot difficult
    6 ## problems.
    7 ##
    8 
    9 ####################################################################
   10 # Copyright @ 1995-1998 University of Rochester
   11 # All Rights Reserved
   12 ####################################################################
   13 
   14 use lib '.'; use webworkInit; # WeBWorKInitLine
   15 use strict;
   16 use Global;
   17 use Auth;
   18 use CGI qw(:standard);
   19 
   20 # Timing code
   21 use Benchmark;
   22 my $beginTime = new Benchmark;
   23 # end Timing code
   24 
   25 
   26 my %inputs;
   27 my ($classID, $setNumber,$User,$Session_key,$batchMode);
   28 
   29 
   30     &CGI::ReadParse;
   31     %inputs = %main::in;
   32 
   33     # get information from CGI inputs  (see also below for additional information)
   34     $classID     = $inputs{'course'};
   35     $setNumber = $inputs{'setNo'};
   36     $User    = $inputs{'user'};
   37     $Session_key = $inputs{'key'};
   38 
   39     unless ($classID && $User && $Session_key) {
   40         &wwerror("$0","The script profCourseRecData.pl did not receive the proper input data.","","", query_string());
   41     }
   42 
   43 # CAUTION:  FOR THIS SCRIPT TO WORK CORRECTLTY,  ALL STUDENTS
   44 #           MUST HAVE BEEN ASSIGNED THE SAME NUMBER OF PROBLREMS
   45 
   46 # print "set is $setNumber";
   47 # print "classID is $classID";
   48 
   49 &getCourseEnvironment($classID);
   50 
   51 my $scriptDirectory   = getWebworkScriptDirectory;
   52 my $databaseDirectory = getCourseDatabaseDirectory;
   53 my $templateDirectory = getCourseTemplateDirectory;
   54 my $cgiURL            = getWebworkCgiURL;
   55 
   56 require "${scriptDirectory}$Global::DBglue_pl";
   57 require "${scriptDirectory}$Global::classlist_DBglue_pl";
   58 require "${scriptDirectory}$Global::FILE_pl";
   59 require "${scriptDirectory}$Global::SCRtools_pl";
   60 require "${scriptDirectory}$Global::HTMLglue_pl";
   61 
   62     my $keyFile = &Global::getCourseKeyFile($classID);
   63     &verify_key($User, $Session_key, $keyFile, $classID);
   64     my $permissionsFile = &Global::getCoursePermissionsFile($classID);
   65     my $permissions = &get_permissions($User, $permissionsFile);
   66 
   67    if (($permissions != $Global::instructor_permissions) and ($permissions != $Global::TA_permissions) ) {
   68         print "permissions = $permissions instructor_permissions= $Global::instructor_permissions\n";
   69         print &html_NO_PERMISSION;
   70         exit(0);
   71     }
   72 my  $DELIM = $Global::delim;
   73 
   74 ## get rest of data from cgi form
   75 $batchMode = $inputs{'batchMode'};  ## if 1 it means user has choosen to ignore warning message
   76 
   77 # get list of problems and values from the database.  Warn user if different students
   78 #have different numbers of problems or different valuse for the same problem
   79 my $cgiMode = 1;
   80 my ($warningMsg,$dueDate, $problemListref,$problemValueListref)
   81     = &readProblemsAndValuesFromDB($setNumber,0,$cgiMode,$batchMode);
   82 
   83 if ($warningMsg ne '') { &warningMsgPage(\%inputs,$warningMsg);}
   84 
   85 my @problemList = @$problemListref;
   86 my @problemValueList = @$problemValueListref;
   87 my $noOfProbs = @problemList;
   88 unshift @problemValueList, 0; ##off by 1 problem
   89 
   90 my (%NHash,%YHash,%attemptedProbHash);
   91 my (%totalScoreHash,%attemptedSetHash,%allStudentsHash);
   92 my $total_possible;
   93 my @recitationNameArray = keys (%{getAllRecitations()});
   94 my @excludedRecitationNameArray = ();
   95 @excludedRecitationNameArray = @Global::excluse_these_recitations_from_overall_statistics
   96   if defined @Global::excluse_these_recitations_from_overall_statistics;
   97 
   98 &processRecitationNameArrays();  ##separate included and excluded Recitations
   99 
  100 ## initialize hashes and load up data
  101 
  102 my $all = &uniqueCourseName();
  103 &initializeAndLoadUp(\@recitationNameArray,$all);
  104 
  105 # begin printing HTML text
  106 print &htmlTOP("WeBWorK Course Data");
  107 
  108 # print navigation buttons
  109 print qq!
  110 <A HREF="${cgiURL}profLogin.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}">
  111 <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A><p>
  112 !;
  113 
  114 print <<EOF;
  115 <HR><BR>
  116 
  117 <h3 align="left">Current Statistics for set $setNumber in $classID</h3>
  118 
  119 On this page, you can monitor the average progress of students for all recitations or
  120 by individual recitations. You can identify difficult problems by the percentage of students
  121 who have answered the problem correctly and/or by the average number of incorrect attempts
  122 per problem. All percentages and averages (except \% attempting) are based on the number of
  123 students who have attempted a set or problem, not on the total number of students in the recitation
  124 or course.  Note that 50\% correct on a partial credit question could mean all students got half
  125 credit or half the students got full credit and half got no credit.<p>
  126 The first two tables do not contain data from "excluded" recitations. Excluded recitations
  127 typically contain practices uses, T.A.'s, prof's etc.  Data for excluded recitations is displayed
  128 at the bottom of the page.
  129 <p>
  130 EOF
  131 
  132 
  133 
  134 ## create  $dat arrays with the info. on average scores, etc
  135 
  136 my ($recitationName,$i, $dataRow,$item);
  137 my @dataArray =();
  138 
  139 ## first row
  140 
  141 $dataRow = "recitations$DELIM \# of students$DELIM \% attempting set $setNumber$DELIM average score$DELIM possible score";
  142 push @dataArray, $dataRow;
  143 
  144 ## display whole course data
  145 
  146 $dataRow = "$all $DELIM $allStudentsHash{$all} $DELIM";  ## all Recitations and total # of students
  147 
  148 $item =0;  ## % of students who have attempted at least one problem in set
  149 $item = int(100*$attemptedSetHash{$all}/$allStudentsHash{$all}+.5) if $allStudentsHash{$all};
  150 $dataRow .= "$item $DELIM";
  151 
  152 $item =0;  ## avg score of students who have attempted at least one problem in set
  153 $item = (int($totalScoreHash{$all} *10/$attemptedSetHash{$all}+.5))/10 if $attemptedSetHash{$all};
  154 $item = sprintf '%.1f', $item;
  155 $dataRow .= "$item $DELIM";
  156 $dataRow .= "$total_possible";
  157 
  158 push @dataArray, $dataRow;
  159 
  160 
  161 ## display data for Recitations
  162 foreach $recitationName (@recitationNameArray) {
  163     $dataRow = "$recitationName $DELIM $allStudentsHash{$recitationName} $DELIM";  ## all recitations and total # of students
  164 
  165     $item =0;  ## % of students who have attempted at least one problem in set
  166     $item = int(100*$attemptedSetHash{$recitationName}/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
  167     $dataRow .= "$item $DELIM";
  168 
  169     $item =0;  ## avg score of students who have attempted at least one problem in set
  170     $item = (int($totalScoreHash{$recitationName} *10/$attemptedSetHash{$recitationName}+.5))/10 if $attemptedSetHash{$recitationName};
  171     $item = sprintf '%.1f', $item;
  172     $dataRow .= "$item $DELIM";
  173     $dataRow .= "$total_possible";
  174     push @dataArray, $dataRow;
  175 }
  176 # print "<pre> @dataArray <\pre>";
  177 
  178 print <<EOF;
  179 <HR><BR>
  180 <h3 align="left">Overall Scores by recitation. $all is the total for all included recitations</h3>
  181 EOF
  182 
  183 ## output the html table
  184 my $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
  185 print "${string}<BR>";
  186 
  187 ## now output the info on individaul problems
  188 
  189 
  190 ### display whole course data
  191 @dataArray =();
  192 $dataRow = "$all $DELIM";
  193 for ($i=1;$i<=$noOfProbs;$i++) {
  194     $dataRow .= "\# $i  $DELIM";
  195 }
  196 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  197 
  198 push @dataArray, $dataRow;
  199 
  200 $dataRow = "\% attempting $DELIM";
  201 for ($i=1;$i<=$noOfProbs;$i++) {
  202     $item =0;   ## percent of students who have attempted this problem
  203     $item = int(100*$attemptedProbHash{$all}[$i]/$allStudentsHash{$all}+.5) if $allStudentsHash{$all};
  204     $dataRow .= "$item $DELIM";
  205 
  206 }
  207 
  208 
  209 
  210 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  211 push @dataArray, $dataRow;
  212 
  213 
  214 
  215 $dataRow = "percent correct $DELIM";  ## all recitations and total # of students
  216 for ($i=1;$i<=$noOfProbs;$i++) {
  217     $item =0;  ## % of students who have attempted this problem
  218     $item = int(100*$YHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5) if $attemptedProbHash{$all}[$i];
  219     $dataRow .= "$item $DELIM";
  220 }
  221 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  222 push @dataArray, $dataRow;
  223 
  224 $dataRow = "average incorrect $DELIM";  ## all recitations and total # of students
  225 for ($i=1;$i<=$noOfProbs;$i++) {
  226 
  227     $item =0;   ## avg # of incorrect attempts of students who have attempted this problem
  228     $item = (int(10*$NHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5))/10 if $attemptedProbHash{$all}[$i];
  229     $item = sprintf '%.1f', $item;
  230     $dataRow .= "$item $DELIM";
  231 }
  232 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  233 push @dataArray, $dataRow;
  234 
  235 print <<EOF;
  236 
  237 <h3 align="left">Data on individual problems by recitation. $all is the total for all included recitations</h3>
  238 EOF
  239 ### output the html table
  240 #$string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
  241 #print "${string}<BR>";
  242 
  243 
  244 ## display data for recitations
  245 
  246 foreach $recitationName (@recitationNameArray) {
  247 
  248     ## add blank row to table to seperate recitations
  249     $dataRow = '<BR>';
  250     push @dataArray, $dataRow;
  251 #    @dataArray =();
  252     $dataRow = "$recitationName $DELIM";
  253     for ($i=1;$i<=$noOfProbs;$i++) {
  254         $dataRow .= "\# $i  $DELIM";
  255     }
  256     $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  257 
  258     push @dataArray, $dataRow;
  259 
  260     $dataRow = "\% attempting $DELIM";
  261     for ($i=1;$i<=$noOfProbs;$i++) {
  262         $item =0;   ## percent of students who have attempted this problem
  263         $item = int(100*$attemptedProbHash{$recitationName}[$i]/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
  264         $dataRow .= "$item $DELIM";
  265     }
  266 
  267 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  268 push @dataArray, $dataRow;
  269 
  270 
  271 
  272 
  273     $dataRow = "percent correct $DELIM";  ## all recitations and total # of students
  274     for ($i=1;$i<=$noOfProbs;$i++) {
  275         $item =0;  ## % of students who have attempted this problem
  276         $item = int(100*$YHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5) if $attemptedProbHash{$recitationName}[$i];
  277         $dataRow .= "$item $DELIM";
  278     }
  279     $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  280     push @dataArray, $dataRow;
  281 
  282     $dataRow = "average incorrect $DELIM";  ## all recitations and total # of students
  283     for ($i=1;$i<=$noOfProbs;$i++) {
  284 
  285        $item =0;   ## avg # of incorrect attempts of students who have attempted this problem
  286        $item = (int(10*$NHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5))/10 if $attemptedProbHash{$recitationName}[$i];
  287        $item = sprintf '%.1f', $item;
  288        $dataRow .= "$item $DELIM";
  289     }
  290     $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  291     push @dataArray, $dataRow;
  292 
  293 #    ## output the html table
  294 #    my $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
  295 #    print "${string}<BR>";
  296 
  297 }
  298 
  299 ## output the html table
  300 $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
  301 print "${string}<BR>";
  302 
  303 
  304 
  305 ## Now print everything again for excluded recitations
  306 
  307 ##################################################################################################
  308 
  309 print <<EOF;
  310 <HR><HR><BR>
  311 
  312 <h3 align="left">Current Statistics for Excluded Recitations</h3>
  313 
  314 Excluded recitations typically contain practices uses, T.A.'s, prof's etc.  The list
  315 of excluded recitations in contained in the webworkCourse.ph file and typically consists
  316 of a recitation with an empty name.
  317 <p>
  318 EOF
  319 
  320 
  321 
  322 &initializeAndLoadUp(\@excludedRecitationNameArray,'Excluded');
  323 $all = 'Excluded';
  324 
  325 ## create  $dat arrays with the info. on average scores, etc
  326 
  327 
  328 @dataArray =();
  329 
  330 ## first row
  331 
  332 $dataRow = "recitations$DELIM \# of students$DELIM \% attempting set $setNumber$DELIM average score$DELIM possible score";
  333 push @dataArray, $dataRow;
  334 
  335 ## display whole course data
  336 
  337 $dataRow = "$all $DELIM $allStudentsHash{$all} $DELIM";  ## all recitations and total # of students
  338 
  339 $item =0;  ## % of students who have attempted at least one problem in set
  340 $item = int(100*$attemptedSetHash{$all}/$allStudentsHash{$all}+.5) if $allStudentsHash{$all};
  341 $dataRow .= "$item $DELIM";
  342 
  343 $item =0;  ## avg score of students who have attempted at least one problem in set
  344 $item = (int($totalScoreHash{$all} *10/$attemptedSetHash{$all}+.5))/10 if $attemptedSetHash{$all};
  345 $item = sprintf '%.1f', $item;
  346 $dataRow .= "$item $DELIM";
  347 $dataRow .= "$total_possible";
  348 
  349 push @dataArray, $dataRow;
  350 
  351 
  352 ## display data for recitations
  353 foreach $recitationName (@excludedRecitationNameArray) {
  354     $dataRow = "$recitationName $DELIM $allStudentsHash{$recitationName} $DELIM";  ## all recitations and total # of students
  355 
  356     $item =0;  ## % of students who have attempted at least one problem in set
  357     $item = int(100*$attemptedSetHash{$recitationName}/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
  358     $dataRow .= "$item $DELIM";
  359 
  360     $item =0;  ## avg score of students who have attempted at least one problem in set
  361     $item = (int($totalScoreHash{$recitationName} *10/$attemptedSetHash{$recitationName}+.5))/10 if $attemptedSetHash{$recitationName};
  362     $item = sprintf '%.1f', $item;
  363     $dataRow .= "$item $DELIM";
  364     $dataRow .= "$total_possible";
  365     push @dataArray, $dataRow;
  366 }
  367 # print "<pre> @dataArray <\pre>";
  368 
  369 print <<EOF;
  370 <HR><BR>
  371 <h3 align="left">Overall Scores by recitation. $all is the total for all excluded recitations</h3>
  372 EOF
  373 
  374 ## output the html table
  375 $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
  376 print "${string}<BR>";
  377 
  378 ## now output the info on individaul problems
  379 
  380 
  381 ### display whole course data
  382 @dataArray =();
  383 $dataRow = "$all $DELIM";
  384 for ($i=1;$i<=$noOfProbs;$i++) {
  385     $dataRow .= "\# $i  $DELIM";
  386 }
  387 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  388 
  389 push @dataArray, $dataRow;
  390 
  391 $dataRow = "\% attempting $DELIM";
  392 for ($i=1;$i<=$noOfProbs;$i++) {
  393     $item =0;   ## percent of students who have attempted this problem
  394     $item = int(100*$attemptedProbHash{$all}[$i]/$allStudentsHash{$all}+.5) if $allStudentsHash{$all};
  395     $dataRow .= "$item $DELIM";
  396 
  397 }
  398 
  399 
  400 
  401 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  402 push @dataArray, $dataRow;
  403 
  404 
  405 
  406 $dataRow = "percent correct $DELIM";  ## all recitations and total # of students
  407 for ($i=1;$i<=$noOfProbs;$i++) {
  408     $item =0;  ## % of students who have attempted this problem
  409     $item = int(100*$YHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5) if $attemptedProbHash{$all}[$i];
  410     $dataRow .= "$item $DELIM";
  411 }
  412 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  413 push @dataArray, $dataRow;
  414 
  415 $dataRow = "average incorrect $DELIM";  ## all recitations and total # of students
  416 for ($i=1;$i<=$noOfProbs;$i++) {
  417 
  418     $item =0;   ## avg # of incorrect attempts of students who have attempted this problem
  419     $item = (int(10*$NHash{$all}[$i]/$attemptedProbHash{$all}[$i]+.5))/10 if $attemptedProbHash{$all}[$i];
  420     $item = sprintf '%.1f', $item;
  421     $dataRow .= "$item $DELIM";
  422 }
  423 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  424 push @dataArray, $dataRow;
  425 
  426 print <<EOF;
  427 
  428 <h3 align="left">Data on individual problems by recitation. $all is the total for all excluded recitations</h3>
  429 EOF
  430 ### output the html table
  431 #$string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
  432 #print "${string}<BR>";
  433 
  434 
  435 ## display data for recitations
  436 
  437 foreach $recitationName (@excludedRecitationNameArray) {
  438 
  439     ## add blank row to table to seperate recitations
  440     $dataRow = '<BR>';
  441     push @dataArray, $dataRow;
  442 #    @dataArray =();
  443     $dataRow = "$recitationName $DELIM";
  444     for ($i=1;$i<=$noOfProbs;$i++) {
  445         $dataRow .= "\# $i  $DELIM";
  446     }
  447     $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  448 
  449     push @dataArray, $dataRow;
  450 
  451     $dataRow = "\% attempting $DELIM";
  452     for ($i=1;$i<=$noOfProbs;$i++) {
  453         $item =0;   ## percent of students who have attempted this problem
  454         $item = int(100*$attemptedProbHash{$recitationName}[$i]/$allStudentsHash{$recitationName}+.5) if $allStudentsHash{$recitationName};
  455         $dataRow .= "$item $DELIM";
  456     }
  457 
  458 $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  459 push @dataArray, $dataRow;
  460 
  461 
  462 
  463 
  464     $dataRow = "percent correct $DELIM";  ## all recitations and total # of students
  465     for ($i=1;$i<=$noOfProbs;$i++) {
  466         $item =0;  ## % of students who have attempted this problem
  467         $item = int(100*$YHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5) if $attemptedProbHash{$recitationName}[$i];
  468         $dataRow .= "$item $DELIM";
  469     }
  470     $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  471     push @dataArray, $dataRow;
  472 
  473     $dataRow = "average incorrect $DELIM";  ## all recitations and total # of students
  474     for ($i=1;$i<=$noOfProbs;$i++) {
  475 
  476        $item =0;   ## avg # of incorrect attempts of students who have attempted this problem
  477        $item = (int(10*$NHash{$recitationName}[$i]/$attemptedProbHash{$recitationName}[$i]+.5))/10 if $attemptedProbHash{$recitationName}[$i];
  478        $item = sprintf '%.1f', $item;
  479        $dataRow .= "$item $DELIM";
  480     }
  481     $dataRow =~ s|$DELIM$||;  ## remove last \$DELIM
  482     push @dataArray, $dataRow;
  483 
  484 #    ## output the html table
  485 #    my $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
  486 #    print "${string}<BR>";
  487 
  488 }
  489 
  490 ## output the html table
  491 $string = &delimitedArray2htmlTable(\@dataArray, 'htmltable');
  492 print "${string}<BR>";
  493 
  494 
  495 
  496 
  497 
  498 
  499 ####################################################################################################
  500 
  501 print &htmlBOTTOM("profCourseRecData.pl", \%inputs, 'profCourseRecDataHelp.html');
  502 
  503 # begin Timing code
  504 my $endTime = new Benchmark;
  505 &Global::logTimingInfo($beginTime,$endTime,"profCourseRecData.pl",$inputs{'course'},$inputs{'user'});
  506 # end Timing code
  507 exit;
  508 
  509 
  510 ##subroutines
  511 
  512 sub processRecitationNameArrays {
  513     ## first consider all blank entries (i.e. empty or white space) in excludedRecitationNameArray
  514     ## to be the same recitation, namely ' '
  515     my %temp_hash =();
  516     my $recitationName;
  517     foreach $recitationName (@excludedRecitationNameArray) {
  518         if ((!defined ($recitationName)) or ($recitationName =~ m|^\s*$|)) {$recitationName = ' ';}
  519         $temp_hash{$recitationName} =1;
  520     }
  521     @excludedRecitationNameArray = keys %temp_hash;
  522 
  523     ## Make sure excludedRecitationNameArray is a subset of recitationNameArray
  524     %temp_hash =();
  525     grep($temp_hash{$_}++,@recitationNameArray);
  526     @excludedRecitationNameArray = grep($temp_hash{$_},@excludedRecitationNameArray);
  527 
  528     ## Now remove excluded recitations from recitation list
  529     %temp_hash =();
  530     grep($temp_hash{$_}++,@excludedRecitationNameArray);
  531     @recitationNameArray = grep(!$temp_hash{$_},@recitationNameArray);
  532 
  533     @recitationNameArray = sort @recitationNameArray;
  534     @excludedRecitationNameArray = sort @excludedRecitationNameArray;
  535 }
  536 
  537 sub initializeAndLoadUp {
  538     my ($recitationNameArrayref, $wholeCourseName) = @_;
  539     my @recitationNameArray = @$recitationNameArrayref;
  540     my $all = $wholeCourseName;
  541     my ($recitationName,$i,$score);
  542 
  543     ## compute total possible points
  544     $total_possible = 0;
  545     for ($i=1;$i<=$noOfProbs;$i++) {$total_possible += $problemValueList[$i];}
  546 
  547     foreach $recitationName (@recitationNameArray) {
  548         $totalScoreHash{$recitationName} = 0;
  549         $attemptedSetHash{$recitationName} = 0;
  550         $allStudentsHash{$recitationName} = 0;
  551         for ($i=1;$i<=$noOfProbs;$i++) {
  552             $NHash{$recitationName}[$i]=0;   ## contains number of incorrect responses
  553             $YHash{$recitationName}[$i]=0;   ## contains totals of problem scores (i.e. a
  554                                           ## number in [0,1] for each problem
  555             $attemptedProbHash{$recitationName}[$i]=0;
  556         }
  557     }
  558 
  559     ## load up hashes with data
  560 
  561     my @pinNumbersArray = &getAllProbSetKeysForSet($setNumber);
  562     my ($studentAttemptedAProblem, $numIncorr, $pin, $status,$login_name_for_psvn);
  563         foreach $pin (@pinNumbersArray) {
  564             attachProbSetRecord($pin);
  565       $login_name_for_psvn = &getStudentLogin($pin);
  566       attachCLRecord($login_name_for_psvn);
  567             $status = CL_getStudentStatus($login_name_for_psvn);
  568       next if dropStatus($status);
  569             $studentAttemptedAProblem = 0;
  570             $recitationName = &CL_getClassRecitation($login_name_for_psvn);
  571             if ((!defined ($recitationName)) or ($recitationName =~ m|^\s*$|)){
  572                         $recitationName = ' ';
  573             }
  574             $allStudentsHash{$recitationName} += 1;
  575 
  576                 for ($i=1;$i<=$noOfProbs;$i++) {
  577                     if (&getProblemAttempted($i,$pin)) {
  578                         $studentAttemptedAProblem = 1;
  579                         $numIncorr = &getProblemNumOfIncorrectAns($i,$pin);
  580                         $numIncorr =0 unless defined $numIncorr;
  581                         $numIncorr = &min($numIncorr,99);
  582                         $NHash{$recitationName}[$i] += $numIncorr;
  583                         $attemptedProbHash{$recitationName}[$i] += 1;
  584                         $score = &getProblemStatus($i,$pin);
  585                         $YHash{$recitationName}[$i] += $score;
  586                         $totalScoreHash{$recitationName} += round_score($score*$problemValueList[$i]);
  587                     }
  588                 }
  589                 if ($studentAttemptedAProblem) {$attemptedSetHash{$recitationName} += 1;}
  590             }
  591 
  592     ## initialize whole course data
  593         $totalScoreHash{$all} = 0;
  594         $attemptedSetHash{$all} = 0;
  595         $allStudentsHash{$all} = 0;
  596         for ($i=1;$i<=$noOfProbs;$i++) {
  597             $NHash{$all}[$i]=0;
  598             $YHash{$all}[$i]=0;
  599             $attemptedProbHash{$all}[$i]=0;
  600         }
  601 
  602     ## compute whole course data
  603     foreach $recitationName (@recitationNameArray) {
  604         $totalScoreHash{$all} += $totalScoreHash{$recitationName};
  605         $attemptedSetHash{$all} += $attemptedSetHash{$recitationName};
  606         $allStudentsHash{$all} += $allStudentsHash{$recitationName};
  607         for ($i=1;$i<=$noOfProbs;$i++) {
  608             $NHash{$all}[$i] += $NHash{$recitationName}[$i];
  609             $YHash{$all}[$i] += $YHash{$recitationName}[$i];
  610             $attemptedProbHash{$all}[$i] += $attemptedProbHash{$recitationName}[$i];
  611         }
  612     }
  613 }
  614 ## find unique name
  615 sub uniqueCourseName {
  616     my $all = $classID;
  617     if (exists $allStudentsHash{$all}) {
  618         my $j = 1;
  619         $all = "${all}$j";
  620         while (exists $allStudentsHash{$all}) {
  621             $j++;
  622             $all = "${all}$j";
  623         }
  624     }
  625 $all
  626 }
  627 
  628 
  629 
  630 sub warningMsgPage {
  631 
  632 my ($inputref,$warningMsg)  = @_;
  633 my %inputs = %$inputref;
  634 # print HTML text
  635 print &htmlTOP("Scoring Utilities");
  636 
  637 # print navigation buttons
  638 print qq!
  639 <A HREF="${Global::cgiWebworkURL}profLogin.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}">
  640 <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A><p>
  641 !;
  642 
  643 print <<EOF;
  644 <HR><BR>
  645 <h3 align="left">WeBWorK scoring WARNING message for $classID:</h3>
  646 EOF
  647 print "<pre>";
  648 print $warningMsg;
  649 print "</pre>";
  650 print "To Continue displaying data for $setNumber, check the \"Continue\" check box and then select
  651 \"Continue displaying data for $setNumber\". <BR> To Quit and return to the Scoring page, select the \"Up\"
  652 buttom.";
  653 
  654 ## profScoring form -- allows you to score problem sets
  655 print <<EOF;
  656 <P>
  657 
  658         <FORM METHOD = "POST" ACTION= "${cgiURL}profCourseRecData.pl">
  659          <INPUT TYPE="SUBMIT" VALUE="Continue displaying data for $setNumber">
  660 
  661 EOF
  662 
  663 
  664     print qq{
  665         <BR><INPUT TYPE=CHECKBOX NAME="batchMode" VALUE=1 >Continue
  666         };
  667 
  668 # resume printing the rest of the form
  669 
  670 print <<EOF;
  671          <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  672          <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  673          <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  674          <INPUT TYPE="HIDDEN" NAME="setNo" VALUE="$inputs{'setNo'}">
  675          </FORM>
  676 EOF
  677 
  678 
  679 print &htmlBOTTOM("profLogin.pl", \%inputs);
  680 exit;
  681 } #end of warning Page
  682 
  683 
  684 
  685 
  686 
  687 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9