Diff for /loncom/interface/loncoursedata.pm between versions 1.23 and 1.27

version 1.23, 2002/08/28 22:02:47 version 1.27, 2002/08/31 18:31:15
Line 693  sub ProcessStudentData { Line 693  sub ProcessStudentData {
         return;          return;
     }      }
   
       if(defined($cache->{$name.':keys'})) {
    foreach (split(':::', $cache->{$name.':keys'})) {
       delete $cache->{$name.':'.$_};
    }
       }
   
       my %courseKeys;
     # user name:domain was prepended earlier in DownloadCourseInformation      # user name:domain was prepended earlier in DownloadCourseInformation
     foreach (keys %$courseData) {      foreach (keys %$courseData) {
    my $currentKey =~ s/^$name//;
    $courseKeys{$currentKey}++;
         $cache->{$_}=$courseData->{$_};          $cache->{$_}=$courseData->{$_};
     }      }
   
       $cache->{$name.':keys'} = join(':::', keys(%courseKeys));
   
     return;      return;
 }  }
   
Line 753  sub ExtractStudentData { Line 764  sub ExtractStudentData {
         return;          return;
     }      }
   
       my %allkeys;
       if(defined($output->{$name.':keys'})) {
    foreach (split(':::', $output->{$name.':keys'})) {
       delete $output->{$name.':'.$_};
    }
       }
   
     my ($username,$domain)=split(':',$name);      my ($username,$domain)=split(':',$name);
   
     my $Version;      my $Version;
Line 768  sub ExtractStudentData { Line 786  sub ExtractStudentData {
   
             # Output dashes for all the parts of this problem if there              # Output dashes for all the parts of this problem if there
             # is no version information about the current problem.              # is no version information about the current problem.
               $output->{$name.':'.$problemID.':NoVersion'} = 'false';
               $allkeys{$name.':'.$problemID.':NoVersion'}++;
             if(!$LatestVersion) {              if(!$LatestVersion) {
                 foreach my $part (split(/\:/,$data->{$sequence.':'.                  foreach my $part (split(/\:/,$data->{$sequence.':'.
                                                       $problemID.                                                        $problemID.
Line 775  sub ExtractStudentData { Line 795  sub ExtractStudentData {
                     $output->{$name.':'.$problemID.':'.$part.':tries'} = 0;                      $output->{$name.':'.$problemID.':'.$part.':tries'} = 0;
                     $output->{$name.':'.$problemID.':'.$part.':awarded'} = 0;                      $output->{$name.':'.$problemID.':'.$part.':awarded'} = 0;
                     $output->{$name.':'.$problemID.':'.$part.':code'} = ' ';                      $output->{$name.':'.$problemID.':'.$part.':code'} = ' ';
       $allkeys{$name.':'.$problemID.':'.$part.':tries'}++;
       $allkeys{$name.':'.$problemID.':'.$part.':awarded'}++;
       $allkeys{$name.':'.$problemID.':'.$part.':code'}++;
                     $totalProblems++;                      $totalProblems++;
                 }                  }
                 $output->{$name.':'.$problemID.':NoVersion'} = 'true';                  $output->{$name.':'.$problemID.':NoVersion'} = 'true';
Line 860  sub ExtractStudentData { Line 883  sub ExtractStudentData {
                                                  ':parts'})) {                                                   ':parts'})) {
                 $output->{$name.':'.$problemID.':'.$part.':wrong'} =                   $output->{$name.':'.$problemID.':'.$part.':wrong'} = 
                     $partData{$part.':tries'};                      $partData{$part.':tries'};
    $allkeys{$name.':'.$problemID.':'.$part.':wrong'}++;
   
                 if($partData{$part.':code'} eq '*') {                  if($partData{$part.':code'} eq '*') {
                     $output->{$name.':'.$problemID.':'.$part.':wrong'}--;                      $output->{$name.':'.$problemID.':'.$part.':wrong'}--;
Line 875  sub ExtractStudentData { Line 899  sub ExtractStudentData {
                     $partData{$part.':code'};                      $partData{$part.':code'};
                 $output->{$name.':'.$problemID.':'.$part.':awarded'} =                  $output->{$name.':'.$problemID.':'.$part.':awarded'} =
                     $partData{$part.':awarded'};                      $partData{$part.':awarded'};
    $allkeys{$name.':'.$problemID.':'.$part.':tries'}++;
    $allkeys{$name.':'.$problemID.':'.$part.':code'}++;
    $allkeys{$name.':'.$problemID.':'.$part.':awarded'}++;
   
                 $totalAwarded += $partData{$part.':awarded'};                  $totalAwarded += $partData{$part.':awarded'};
                 $output->{$name.':'.$problemID.':'.$part.':timestamp'} =                  $output->{$name.':'.$problemID.':'.$part.':timestamp'} =
                     $partData{$part.':timestamp'};                      $partData{$part.':timestamp'};
    $allkeys{$name.':'.$problemID.':'.$part.':timestamp'}++;
   
                 foreach my $response (split(':', $data->{$sequence.':'.                  foreach my $response (split(':', $data->{$sequence.':'.
                                                          $problemID.':'.                                                           $problemID.':'.
                                                          $part.':responseIDs'})) {                                                           $part.':responseIDs'})) {
                     $output->{$name.':'.$problemID.':'.$part.':'.$response.                      $output->{$name.':'.$problemID.':'.$part.':'.$response.
                               ':submission'}=join(':::',@submissions);                                ':submission'}=join(':::',@submissions);
       $allkeys{$name.':'.$problemID.':'.$part.':'.$response.
        ':submission'}++;
                 }                  }
   
                 if($partData{$part.':code'} ne 'x') {                  if($partData{$part.':code'} ne 'x') {
Line 892  sub ExtractStudentData { Line 924  sub ExtractStudentData {
         }          }
   
         $output->{$name.':'.$sequence.':problemsCorrect'} = $problemsCorrect;          $output->{$name.':'.$sequence.':problemsCorrect'} = $problemsCorrect;
    $allkeys{$name.':'.$sequence.':problemsCorrect'}++;
         $problemsSolved += $problemsCorrect;          $problemsSolved += $problemsCorrect;
  $problemsCorrect=0;   $problemsCorrect=0;
     }      }
Line 899  sub ExtractStudentData { Line 932  sub ExtractStudentData {
     $output->{$name.':problemsSolved'} = $problemsSolved;      $output->{$name.':problemsSolved'} = $problemsSolved;
     $output->{$name.':totalProblems'} = $totalProblems;      $output->{$name.':totalProblems'} = $totalProblems;
     $output->{$name.':totalAwarded'} = $totalAwarded;      $output->{$name.':totalAwarded'} = $totalAwarded;
       $allkeys{$name.':problemsSolved'}++;
       $allkeys{$name.':totalProblems'}++;
       $allkeys{$name.':totalAwarded'}++;
   
       $output->{$name.':keys'} = join(':::', keys(%allkeys));
   
     return;      return;
 }  }
Line 1095  sub DownloadStudentCourseData { Line 1133  sub DownloadStudentCourseData {
     my $title = 'LON-CAPA Statistics';      my $title = 'LON-CAPA Statistics';
     my $heading = 'Download and Process Course Data';      my $heading = 'Download and Process Course Data';
     my $studentCount = scalar(@$students);      my $studentCount = scalar(@$students);
     my %cache;  
   
   
     my $WhatIWant;      my $WhatIWant;
     $WhatIWant = '(^version:|';      $WhatIWant = '(^version:|';
Line 1113  sub DownloadStudentCourseData { Line 1149  sub DownloadStudentCourseData {
     my $displayString;      my $displayString;
     my $count=0;      my $count=0;
     foreach (@$students) {      foreach (@$students) {
           my %cache;
   
         if($c->aborted()) { return 'Aborted'; }          if($c->aborted()) { return 'Aborted'; }
   
         if($status eq 'true') {          if($status eq 'true') {
Line 1130  sub DownloadStudentCourseData { Line 1168  sub DownloadStudentCourseData {
   
         if($c->aborted()) { return 'Aborted'; }          if($c->aborted()) { return 'Aborted'; }
   
         if($downloadTime eq 'Not downloaded') {          #if($downloadTime ne 'Not downloaded') {
             my $courseData =    #    next;
                 &DownloadCourseInformation($_, $courseID, $downloadTime,    #}
                                            $WhatIWant);   my $courseData = 
             if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) {      &DownloadCourseInformation($_, $courseID, $downloadTime, 
                 foreach my $key (keys(%$courseData)) {         $WhatIWant);
                     if($key =~ /^(con_lost|error|no_such_host)/i) {   if(tie(%cache,'GDBM_File',$cacheDB,&GDBM_WRCREAT(),0640)) {
                         $courseData->{$_.':error'} = 'No course data for '.$_;      foreach my $key (keys(%$courseData)) {
                         last;   if($key =~ /^(con_lost|error|no_such_host)/i) {
                     }      $courseData->{$_.':error'} = 'No course data for '.$_;
                 }      last;
                 if($extract eq 'true') {   }
                     &ExtractStudentData($courseData, \%cache, \%cache, $_);      }
                 } else {      if($extract eq 'true') {
                     &ProcessStudentData(\%cache, $courseData, $_);   &ExtractStudentData($courseData, \%cache, \%cache, $_);
                 }      } else {
                 untie(%cache);   &ProcessStudentData(\%cache, $courseData, $_);
             } else {      }
                 next;      untie(%cache);
             }   } else {
         }      next;
    }
     }      }
     if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); }      if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); }
   
Line 1172  sub DownloadStudentCourseDataSeparate { Line 1211  sub DownloadStudentCourseDataSeparate {
   
     &CheckForResidualDownload($courseID, $cacheDB, $students, $c);      &CheckForResidualDownload($courseID, $cacheDB, $students, $c);
   
     my %cache;  
   
     my $studentCount = scalar(@$students);      my $studentCount = scalar(@$students);
     if($status eq 'true') {      if($status eq 'true') {
         &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading);          &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading);
Line 1191  sub DownloadStudentCourseDataSeparate { Line 1228  sub DownloadStudentCourseDataSeparate {
             &Apache::lonhtmlcommon::Update_PrgWin($displayString, $r);              &Apache::lonhtmlcommon::Update_PrgWin($displayString, $r);
         }          }
   
           my %cache;
         my $downloadTime='Not downloaded';          my $downloadTime='Not downloaded';
         if($checkDate eq 'true'  &&           if($checkDate eq 'true'  && 
            tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {             tie(%cache,'GDBM_File',$cacheDB,&GDBM_READER(),0640)) {
Line 1202  sub DownloadStudentCourseDataSeparate { Line 1240  sub DownloadStudentCourseDataSeparate {
             return 'Aborted';              return 'Aborted';
         }          }
   
         if($downloadTime eq 'Not downloaded') {          #if($downloadTime eq 'Not downloaded') {
             my $error = 0;              my $error = 0;
             my $courseData =               my $courseData = 
                 &DownloadCourseInformation($_, $courseID, $downloadTime,                  &DownloadCourseInformation($_, $courseID, $downloadTime,
Line 1226  sub DownloadStudentCourseDataSeparate { Line 1264  sub DownloadStudentCourseDataSeparate {
                 $downloadData{$_.':error'} = 'No course data for '.$_;                  $downloadData{$_.':error'} = 'No course data for '.$_;
             }              }
             untie(%downloadData);              untie(%downloadData);
         }          #}
     }      }
     if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); }      if($status eq 'true') { &Apache::lonhtmlcommon::Close_PrgWin($r); }
   

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


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