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

version 1.23, 2002/12/24 21:00:21 version 1.26, 2003/01/09 16:37:48
Line 101  sub BuildStudentAssessmentPage { Line 101  sub BuildStudentAssessmentPage {
     if($c->aborted()) {  return $Str; }      if($c->aborted()) {  return $Str; }
   
     my $selected=0;      my $selected=0;
       my $Count = 0;
     $r->print('<pre>'."\n");      $r->print('<pre>'."\n");
     foreach (@$students) {      foreach (@$students) {
         if($c->aborted()) { return $Str; }          if($c->aborted()) { return $Str; }
Line 132  sub BuildStudentAssessmentPage { Line 133  sub BuildStudentAssessmentPage {
                     push(@before, $_);                      push(@before, $_);
                 }                  }
             }              }
             my $displayString = 'DISPLAYDATA'.$spacing;              $Count++;
             $r->print(&Apache::lonhtmlcommon::FormatStudentInformation(      my $out = '';
   #    $out .= sprintf("%3d", $Count);
               if($Count % 2) {
                   $out .= '<bgcolor="#FFFFFF">';
               } else {
                   $out .= '<bgcolor="#F0F0F0">';
               }
       my $displayString = $out.'DISPLAYDATA'.$spacing;
       $r->print(&Apache::lonhtmlcommon::FormatStudentInformation(
                                                          \%cache, $_,                                                           \%cache, $_,
                                                          \@before,                                                           \@before,
                                                          $displayString,                                                           $displayString,
Line 164  sub BuildStudentAssessmentPage { Line 173  sub BuildStudentAssessmentPage {
             untie(%cache);              untie(%cache);
         }          }
     }      }
       $r->print('</pre>'."\n"); 
     if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {  
         $r->print(&StudentAverageTotal(\%cache, $students, $sequenceKeys));  
         untie(%cache);  
     }  
     $r->print('</pre>'."\n");  
     if($selected == 0) {      if($selected == 0) {
  $Str .= '<h3><font color=blue>WARNING: ';   $Str .= '<h3><font color=blue>WARNING: ';
         $Str .= 'Please select a student</font></h3>';          $Str .= 'No Students enrolled OR Please select a student</font></h3>';
         $r->print($Str);          $r->print($Str);
       } else {
    if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
       $r->print(&StudentAverageTotal(\%cache, $students, $sequenceKeys));
       untie(%cache);
    }
     }      }
   
     return;      return;
 }  }
   
Line 238  sub CreateTableHeadings { Line 246  sub CreateTableHeadings {
     my($cache,$spacing,$infoKeys,$infoHeadings,$sequenceKeys,      my($cache,$spacing,$infoKeys,$infoHeadings,$sequenceKeys,
        $sequenceHeadings)=@_;         $sequenceHeadings)=@_;
   
   #    my $Str = '&nbsp&nbsp&nbsp&nbsp&nbsp';
     my $Str = '';      my $Str = '';
     $Str .= '<table border="0" cellpadding="0" cellspacing="0">'."\n";      $Str .= '<table border="0" cellpadding="0" cellspacing="0">'."\n";
   
Line 415  sub StudentAverageTotal { Line 424  sub StudentAverageTotal {
  $ProblemsSolved += $cache->{$name.':problemsSolved'};   $ProblemsSolved += $cache->{$name.':problemsSolved'};
         $TotalProblems += $cache->{$name.':totalProblems'};          $TotalProblems += $cache->{$name.':totalProblems'};
     }      }
     $ProblemsSolved /= $StudentCount;      if ($StudentCount) { 
     $TotalProblems /= $StudentCount;          $ProblemsSolved /= $StudentCount;
               $TotalProblems /= $StudentCount;
     $Str .= '<table border=2 cellspacing="5">'."\n";      } else {
           $ProblemsSolved = 0;
           $TotalProblems  = 0;
       }
       $Str .= '<table border=2 cellspacing="1">'."\n";
     $Str .= '<tr><td><b>Students Count</b></td><td><b>'.      $Str .= '<tr><td><b>Students Count</b></td><td><b>'.
             $StudentCount.'</b></td></tr>'."\n";              $StudentCount.'</b></td></tr>'."\n";
     $Str .= '<tr><td><b>Total Problems</b></td><td><b>'.      $Str .= '<tr><td><b>Total Problems</b></td><td><b>'.
Line 427  sub StudentAverageTotal { Line 440  sub StudentAverageTotal {
             $ProblemsSolved.'</b></td></tr>'."\n";              $ProblemsSolved.'</b></td></tr>'."\n";
     $Str .= '</table>'."\n";      $Str .= '</table>'."\n";
   
     $Str .= '<table border=2 cellspacing="5">'."\n";      $Str .= '<table border=2 cellspacing="1">'."\n";
     $Str .= '<tr><th>Title</th><th>Total Problems</th>'.      $Str .= '<tr><th>Title</th><th>Total Problems</th>'.
             '<th>Average Correct</th></tr>'."\n";              '<th>Average Correct</th></tr>'."\n";
     foreach my $S(@$sequenceKeys) {      foreach my $S(@$sequenceKeys) {
         my $title=$cache->{$S.':title'};          my $title=$cache->{$S.':title'};
  #$Str .= $cache->{$S.':problems'};   #$Str .= $cache->{$S.':problems'};
  #my @problems=split(':', $cache->{$S.':problems'});    #my @problems=split(':', $cache->{$S.':problems'});
  #my $pCount=scalar @problems;   #my $pCount=scalar @problems;
  my $pCount=MaxSeqPr($cache,@$students[0],$S);   my $pCount=MaxSeqPr($cache,@$students[0],$S);
  my $crr=sprintf( "%.2f", $Correct{$S}/$StudentCount );          my $crr;
    if ($StudentCount) {
               $crr=sprintf( "%.2f", $Correct{$S}/$StudentCount );
           } else {
               $crr="0.00";
           }
         $Str .= '<tr><td>'.$title.          $Str .= '<tr><td>'.$title.
                 '</td><td align=center>'.$pCount.                  '</td><td align=center>'.$pCount.
                 '</td><td align=center>'.$crr.                  '</td><td align=center>'.$crr.

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


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