[LON-CAPA-cvs] cvs: loncom /interface loncoursedata.pm

stredwic lon-capa-cvs@mail.lon-capa.org
Thu, 15 Aug 2002 18:16:29 -0000


stredwic		Thu Aug 15 14:16:29 2002 EDT

  Modified files:              
    /loncom/interface	loncoursedata.pm 
  Log:
  Played a little bit more with the downloading regular expression and 
  changed error checking for lonnet::get.  There is a problem in lonnet::get
  that needs to be fixed, and then statistics will properly catch get errors.
  
  
Index: loncom/interface/loncoursedata.pm
diff -u loncom/interface/loncoursedata.pm:1.19 loncom/interface/loncoursedata.pm:1.20
--- loncom/interface/loncoursedata.pm:1.19	Thu Aug 15 12:11:34 2002
+++ loncom/interface/loncoursedata.pm	Thu Aug 15 14:16:29 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # (Publication Handler
 #
-# $Id: loncoursedata.pm,v 1.19 2002/08/15 16:11:34 stredwic Exp $
+# $Id: loncoursedata.pm,v 1.20 2002/08/15 18:16:29 stredwic Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -119,9 +119,10 @@
     }
 
     %classlist=&Apache::lonnet::dump('classlist',$courseDomain, $courseNumber);
-    my ($checkForError)=keys (%classlist);
-    if($checkForError =~ /^(con_lost|error|no_such_host)/i) {
-        return \%classlist;
+    foreach(keys (%classlist)) {
+        if(/^(con_lost|error|no_such_host)/i) {
+            return \%classlist;
+        }
     }
 
     foreach my $name (keys(%classlist)) {
@@ -201,7 +202,6 @@
     if(!defined($WhatIWant)) {
         $WhatIWant = '.';
     }
-        $WhatIWant = '.';
     %courseData=&Apache::lonnet::dump($courseID, $domain, $name, $WhatIWant);
     $courseData{'UpToDate'} = 'false';
     $courseData{'lastDownloadTime'}=time;
@@ -547,7 +547,6 @@
         if($c->aborted()) {
             return ();
         }
-        push(@names,$name);
         my $studentInformation = $classlist->{$name.':studentInformation'},
         my $sectionData = $classlist->{$name.':sections'},
         my $date = $classlist->{$name},
@@ -561,20 +560,24 @@
             $cache->{$name.':updateTime'}=' Not updated';
         }
 
-        my ($checkForError)=keys(%$studentInformation);
-        if($checkForError =~ /^(con_lost|error|no_such_host)/i) {
-            $cache->{$name.':error'}=
-                'Could not download student environment data.';
-            $cache->{$name.':fullname'}='';
-            $cache->{$name.':id'}='';
-        } else {
-            $cache->{$name.':fullname'}=&ProcessFullName(
+        my $error = 0;
+        foreach(keys(%$studentInformation)) {
+            if(/^(con_lost|error|no_such_host)/i) {
+                $cache->{$name.':error'}=
+                    'Could not download student environment data.';
+                $cache->{$name.':fullname'}='';
+                $cache->{$name.':id'}='';
+                $error = 1;
+            }
+        }
+        next if($error);
+        push(@names,$name);
+        $cache->{$name.':fullname'}=&ProcessFullName(
                                           $studentInformation->{'lastname'},
                                           $studentInformation->{'generation'},
                                           $studentInformation->{'firstname'},
                                           $studentInformation->{'middlename'});
-            $cache->{$name.':id'}=$studentInformation->{'id'};
-        }
+        $cache->{$name.':id'}=$studentInformation->{'id'};
 
         my ($end, $start)=split(':',$date);
         $courseID=~s/\_/\//g;
@@ -1016,11 +1019,12 @@
 
 
     my $WhatIWant;
-    $WhatIWant = '(^version:.+?$|';
+    $WhatIWant = '(^version:|';
     $WhatIWant .= '^\d+:.+?:(resource\.\d+\.';
     $WhatIWant .= '(solved|tries|previous|awarded|(\d+\.submission))\s*$';
     $WhatIWant .= '|timestamp)';
     $WhatIWant .= ')';
+#    $WhatIWant = '.';
 
     if($status eq 'true') {
         &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading);
@@ -1079,9 +1083,8 @@
     my $title = 'LON-CAPA Statistics';
     my $heading = 'Download Course Data';
 
-#    my $WhatIWant = '.';
     my $WhatIWant;
-    $WhatIWant = '(^version:.+?$|';
+    $WhatIWant = '(^version:|';
     $WhatIWant .= '^\d+:.+?:(resource\.\d+\.';
     $WhatIWant .= '(solved|tries|previous|awarded|(\d+\.submission))\s*$';
     $WhatIWant .= '|timestamp)';
@@ -1188,7 +1191,7 @@
         &Apache::lonhtmlcommon::Create_PrgWin($r, $title, $heading);
     }
 
-    my c$ount=1;
+    my $count=1;
     foreach my $name (@students) {
         last if($c->aborted());