Diff for /loncom/interface/statistics/lonstudentassessment.pm between versions 1.22 and 1.23

version 1.22, 2002/12/18 20:02:34 version 1.23, 2002/12/24 21:00:21
Line 30 Line 30
 # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei  # 11/1,11/4,11/16,12/14,12/16,12/18,12/20,12/31 Behrouz Minaei
 # YEAR=2002  # YEAR=2002
 # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei  # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26,4/7,5/6 Behrouz Minaei
 # 5/12,5/14,5/15,5/19,5/26,7/16  Behrouz Minaei  # 5/12,5/14,5/15,5/19,5/26,7/16,12/24  Behrouz Minaei
 #  #
 ###  ###
   
Line 165  sub BuildStudentAssessmentPage { Line 165  sub BuildStudentAssessmentPage {
         }          }
     }      }
   
 #    if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {      if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
 #        $r->print(&StudentAverageTotal(\%cache, $students, $sequenceKeys));          $r->print(&StudentAverageTotal(\%cache, $students, $sequenceKeys));
 #        untie(%cache);          untie(%cache);
 #    }      }
     $r->print('</pre>'."\n");      $r->print('</pre>'."\n");
     if($selected == 0) {      if($selected == 0) {
  $Str .= '<h3><font color=blue>WARNING: ';   $Str .= '<h3><font color=blue>WARNING: ';
Line 400  sub StudentReport { Line 400  sub StudentReport {
   
 sub StudentAverageTotal {  sub StudentAverageTotal {
     my ($cache, $students, $sequenceKeys)=@_;      my ($cache, $students, $sequenceKeys)=@_;
     my $Str = "\nAverageTotal\n";      my $Str = "\n<b>Summary Tables:</b>\n";
     my %Correct = ();      my %Correct = ();
     my $ProblemsSolved = 0;      my $ProblemsSolved = 0;
     my $TotalProblems = 0;      my $TotalProblems = 0;
Line 409  sub StudentAverageTotal { Line 409  sub StudentAverageTotal {
     foreach my $name (@$students) {      foreach my $name (@$students) {
         $StudentCount++;          $StudentCount++;
         foreach my $sequence (@$sequenceKeys) {          foreach my $sequence (@$sequenceKeys) {
             $Correct{$cache->{$sequence.':title'}} +=              $Correct{$sequence} +=
         $cache->{$name.':'.$sequence.':problemsCorrect'};         $cache->{$name.':'.$sequence.':problemsCorrect'};
         }          }
  $ProblemsSolved += $cache->{$name.':problemsSolved'};   $ProblemsSolved += $cache->{$name.':problemsSolved'};
         $TotalProblems += $cache->{$name.':totalProblems'};          $TotalProblems += $cache->{$name.':totalProblems'};
     }      }
     $ProblemsSolved /= $StudentCount;      $ProblemsSolved /= $StudentCount;
     $TotalProblems /= $StudentCount;      $TotalProblems /= $StudentCount;
     $Str .= "AvgSlvd:$ProblemsSolved  AvgTotal: $TotalProblems\n";  
           
     foreach (%Correct) {      $Str .= '<table border=2 cellspacing="5">'."\n";
         $Str .= "$_  : $Correct{$_}\n";      $Str .= '<tr><td><b>Students Count</b></td><td><b>'.
               $StudentCount.'</b></td></tr>'."\n";
       $Str .= '<tr><td><b>Total Problems</b></td><td><b>'.
               $TotalProblems.'</b></td></tr>'."\n";
       $Str .= '<tr><td><b>Average Correct</b></td><td><b>'.
               $ProblemsSolved.'</b></td></tr>'."\n";
       $Str .= '</table>'."\n";
   
       $Str .= '<table border=2 cellspacing="5">'."\n";
       $Str .= '<tr><th>Title</th><th>Total Problems</th>'.
               '<th>Average Correct</th></tr>'."\n";
       foreach my $S(@$sequenceKeys) {
           my $title=$cache->{$S.':title'};
    #$Str .= $cache->{$S.':problems'};
    #my @problems=split(':', $cache->{$S.':problems'}); 
    #my $pCount=scalar @problems;
    my $pCount=MaxSeqPr($cache,@$students[0],$S);
    my $crr=sprintf( "%.2f", $Correct{$S}/$StudentCount );
           $Str .= '<tr><td>'.$title.
                   '</td><td align=center>'.$pCount.
                   '</td><td align=center>'.$crr.
                   '</td></tr>'."\n";
     }      }
   
       $Str .= '</table>'."\n";
   
     return $Str;      return $Str;
 }  }
   
   
   
   sub MaxSeqPr {
       my ($cache, $name, $sequence)=@_;
       my $prCount=0;
       foreach my $problemID (split(':', $cache->{$sequence.':problems'})) {
           my $problem = $cache->{$problemID.':problem'};
           foreach(split(/\:/,$cache->{$sequence.':'.$problemID.':parts'})) {
               if($cache->{$name.':'.$problemID.':NoVersion'} eq 'true' ||
                  $cache->{$name.':'.$problemID.':'.$_.':code'} eq ' ' ||
                  $cache->{$name.':'.$problemID.':'.$_.':code'} eq '') {
                    $prCount++;
                    next;
               }
               $prCount++;
           }
       }
       return $prCount;
   }
   
   
   
   
   
 =pod  =pod
   
 =item &CreateLegend()  =item &CreateLegend()

Removed from v.1.22  
changed lines
  Added in v.1.23


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>