Diff for /loncom/interface/lonstatistics.pm between versions 1.13 and 1.14

version 1.13, 2002/03/22 23:06:30 version 1.14, 2002/03/26 18:11:32
Line 28 Line 28
 # (Navigate problems for statistical reports  # (Navigate problems for statistical reports
 # YEAR=2001  # YEAR=2001
 # 5/05,7/09,7/25/01,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei  # 5/05,7/09,7/25/01,8/11,9/13,9/26,10/5,10/9,10/22,10/26 Behrouz Minaei
 # 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 Behrouz Minaei  # 1/22,2/1,2/6,2/25,3/2,3/6,3/17,3/21,3/22,3/26 Behrouz Minaei
   #
 ###  ###
   
 package Apache::lonstatistics;   package Apache::lonstatistics; 
Line 158  sub NumericSort { Line 159  sub NumericSort {
   
 # ------ Create different Student Report   # ------ Create different Student Report 
 sub StudentReport {  sub StudentReport {
   
     my ($sname,$sdom)=@_;      my ($sname,$sdom)=@_;
   
     if ( $sname eq 'All Students' ) {      if ( $sname eq 'All Students' ) {
  $r->print( '<h3><font color=blue>WARNING:    $r->print( '<h3><font color=blue>WARNING: 
                     Please select a student</font></h3>' );                      Please select a student</font></h3>' );
  return;   return;
     }      }
     my $shome=&Apache::lonnet::homeserver($sname,$sdom);                my %result = &Apache::lonnet::dump($cid,$sdom,$sname);
     my $reply=&Apache::lonnet::reply('dump:'.$sdom.':'.$sname.':'.$cid,$shome );  
     my %result = ();  
     my $ResId;      my $ResId;
     my $PrOrd;      my $PrOrd;
     my $Code;      my $Code;
Line 189  sub StudentReport { Line 186  sub StudentReport {
       "\n".'<th> Results </th>'.        "\n".'<th> Results </th>'.
       "\n".'<th> Tries </th>'.        "\n".'<th> Tries </th>'.
       "\n".'</tr>';        "\n".'</tr>';
     unless ($reply=~/^error\:/) {      my ($temp)=keys(%result);
         foreach (split(/\&/,$reply)){      unless ($temp=~/^error\:/) {
             my ($name,$value)=split(/\=/,&Apache::lonnet::unescape($_));  
             $result{$name}=$value;  
         }  
         foreach my $CurCol (@cols) {          foreach my $CurCol (@cols) {
     if (!$CurCol){      if (!$CurCol){
  my $Set=&Apache::lonnet::declutter($hash{'map_id_'.$1});   my $Set=&Apache::lonnet::declutter($hash{'map_id_'.$1});
Line 231  sub StudentReport { Line 225  sub StudentReport {
  $PartNo++;   $PartNo++;
     }      }
  }   }
  #if ($_=~/^parameter\_(\w+)\_package$/) {  
             }              }
   
             my $Prob = $Map.'___'.$2.'___'.              my $Prob = $Map.'___'.$2.'___'.
Line 362  sub PreStatTable { Line 355  sub PreStatTable {
  'evaluating the problem according to a Criterion<br>'.   'evaluating the problem according to a Criterion<br>'.
  '<b>           [Applied Criterion in %27 Upper Students - '.   '<b>           [Applied Criterion in %27 Upper Students - '.
  'Applied the same Criterion in %27 Lower Students]</b><br>'.   'Applied the same Criterion in %27 Lower Students]</b><br>'.
     '<b>           1st </b>Criterion for Sorting the Students: '.      '<b>           1st Criterion</b> for Sorting the Students: '.
  'Sum of Partial Credit Awarded / Total Number of Tries<br>'.   '<b>Sum of Partial Credit Awarded / Total Number of Tries</b><br>'.
     '<b>           2nd </b>Criterion for Sorting the Students: '.      '<b>           2nd Criterion</b> for Sorting the Students: '.
  'Total number of Correct Answers / Total Number of Tries'.   '<b>Total number of Correct Answers / Total Number of Tries</b>'.
             '</pre>';              '</pre>';
   
     $r->print($Ptr);      $r->print($Ptr);
Line 456  sub usection { Line 449  sub usection {
 # ------ Dump the Student's DB file and handling the data for statistics table   # ------ Dump the Student's DB file and handling the data for statistics table 
   
 sub ExtractStudentData {  sub ExtractStudentData {
     my ($student,$coid)=@_;      my $student=shift;
     my ($sname,$sdom) = split( /\:/, $student );      my ($sname,$sdom) = split( /\:/, $student );
     my $shome=&Apache::lonnet::homeserver( $sname,$sdom );                my %result = &Apache::lonnet::dump($cid,$sdom,$sname);
     my $reply=&Apache::lonnet::reply('dump:'.$sdom.':'.$sname.':'.$coid,$shome );  
     my %result = ();  
     my $ResId;      my $ResId;
     my $PrOrd;      my $PrOrd;
     my $Dis = '';      my $Dis = '';
Line 479  sub ExtractStudentData { Line 470  sub ExtractStudentData {
     my $LatestVersion;      my $LatestVersion;
     my $SecLimit;      my $SecLimit;
     my $MapLimit;      my $MapLimit;
     unless ($reply=~/^error\:/) {      my ($temp)=keys(%result);
         foreach (split(/\&/,$reply)) {      unless ($temp=~/^error\:/) {
             my ($name,$value)=split(/\=/,&Apache::lonnet::unescape($_));  
             $result{$name}=$value;  
         }  
         foreach my $CurCol(@cols) {          foreach my $CurCol(@cols) {
     ($PrOrd,$ResId)=split(/\:/,$CurCol);      ($PrOrd,$ResId)=split(/\:/,$CurCol);
     if ( !$CurCol ) { next; }      if ( !$CurCol ) { next; }
Line 510  sub ExtractStudentData { Line 498  sub ExtractStudentData {
  $TempHash{"$Part.PrOrd"} = $PrOrd+$PartNo;   $TempHash{"$Part.PrOrd"} = $PrOrd+$PartNo;
  $PartNo++;   $PartNo++;
     }      }
                     my $Part=&Apache::lonnet::metadata($meta,$_.'.part');                      #my $Part=&Apache::lonnet::metadata($meta,$_.'.part');
  }   }
             }              }
   
             my $Prob = $Map.'___'.$PrbId.'___'.              my $Prob = $Map.'___'.$PrbId.'___'.
                        &Apache::lonnet::declutter( $hash{'src_'.$ResId} );                         &Apache::lonnet::declutter( $hash{'src_'.$ResId} );
     $OpResp{$PrOrd}=$Prob;  
             $Code='U';              $Code='U';
             $Tries = 0;              $Tries = 0;
     $ParCr = 0;      $ParCr = 0;
Line 524  sub ExtractStudentData { Line 511  sub ExtractStudentData {
      $LatestVersion = $result{"version:$Prob"};              $LatestVersion = $result{"version:$Prob"};       
   
     if ( $LatestVersion ) {      if ( $LatestVersion ) {
 #333333333  
 #my $userview=&Apache::lonnet::ssi($hash{'src_'.$ResId});  
 #$r->print('<br>'.$userview);   
 #$r->print('<br>'.$Prob.$sname.$sdom.$coid.'<br>'.&get_student_answers($Prob,$sname,$sdom,$coid));   
   
  for ( my $Version=1; $Version<=$LatestVersion; $Version++ ) {   for ( my $Version=1; $Version<=$LatestVersion; $Version++ ) {
     my $vkeys = $result{"$Version:keys:$Prob"};      my $vkeys = $result{"$Version:keys:$Prob"};
     my @keys = split(/\:/,$vkeys);      my @keys = split(/\:/,$vkeys);
     
     foreach my $Key (@keys) {        foreach my $Key (@keys) {  
   #333333333
   # if ($OpResp{$PrOrd}) {
   #    if (($Key=~/\.(\w+)\.submission$/)) {
   # my $Resp = $result{"$Version:$Prob:$Key"};
   # $r->print('<br>'.$Prob.'<br>'.$sname.'<br>'.$PrOrd.'<br>'.$Key.'<br><b>'.$Resp.'</b>'); 
   # $r->rflush();
   #
   # my %submission=&Apache::lonnet::str2hash($Resp);
   #    my $cb=0;
   #    foreach (sort keys %submission) {
   # $r->print('<br>'.$cb.')'.$_.' ... '.$submission{$_});
   # $cb++;
   #    }
   #    }  
   # }
  if (($Key=~/\.(\w+)\.solved$/) && ($Key!~/^\d+\:/)) {   if (($Key=~/\.(\w+)\.solved$/) && ($Key!~/^\d+\:/)) {
     my $Part = $1;      my $Part = $1;
     $Tries = $result{"$Version:$Prob:resource.$Part.tries"};      $Tries = $result{"$Version:$Prob:resource.$Part.tries"};
Line 644  sub tracetable { Line 641  sub tracetable {
               
        my $meta=$hash{'src_'.$frid};         my $meta=$hash{'src_'.$frid};
        my $PartNo = 0;         my $PartNo = 0;
          my $Part;
  #       if ($IsMap==0){   #       if ($IsMap==0){
                if ($meta) {                 if ($meta) {
    if ($meta=~/\.(problem|exam|quiz|assess|survey|form)$/) {     if ($meta=~/\.(problem|exam|quiz|assess|survey|form)$/) {
        foreach (split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) {         foreach (split(/\,/,&Apache::lonnet::metadata($meta,'keys'))) {
    if ($_=~/^stores\_(\w+)\_tries$/) {     if ($_=~/^stores\_(\w+)\_tries$/) {
        &Apache::lonnet::metadata($meta,$_.'.part');         $Part=&Apache::lonnet::metadata($meta,$_.'.part');
        $P_Order++;         $P_Order++;
        $mapsort{$HWN} .= '&'.$P_Order;         $mapsort{$HWN} .= '&'.$P_Order;
        $PartNo++;         $PartNo++;
        #$r->print('<br>'.$PartNo.'---'.$P_Order);         #$r->print('<br>'.$PartNo.'---'.$P_Order);
    }     }
      foreach my $K(split(/\,/,&Apache::lonnet::metadata($meta,'packages'))) {
          if ($K=~/^optionresponse\_($Part)\_(\w+)$/) {
      #$r->print('<br>'.$_.'...'.$P_Order.'---'.$Part);
      $OpResp{$P_Order+1}=$frid;
          } 
      
      }
        }         }
 #       foreach (split(/\,/,&Apache::lonnet::metadata($meta,'packages'))) {  
 #   if ($_=~/^optionresponse\_(\w+)\_(\w+)$/) {  
 #       $r->print('<br>'.$_.&Apache::lonnet::metadata($meta,$_));  
 #       $r->print('<br>'.$_.'...'.$P_Order);  
 #       $OpResp{$P_Order+1}=$frid;  
 #   }   
 #       }  
    }     }
                }                 }
    }     }
Line 735  ENDPOP Line 733  ENDPOP
                   $students[$index].'";</script>');                    $students[$index].'";</script>');
         $r->rflush();          $r->rflush();
   
         &ExtractStudentData($students[$index],$cid);          &ExtractStudentData($students[$index]);
     }      }
   
 # -------------------- sorting the Data  # -------------------- sorting the Data

Removed from v.1.13  
changed lines
  Added in v.1.14


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