[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /homework grades.pm

raeburn raeburn@source.lon-capa.org
Wed, 27 Jan 2010 06:28:36 -0000


raeburn		Wed Jan 27 06:28:36 2010 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/homework	grades.pm 
  Log:
  - Backport 1.586, 1.591.
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.574.2.7 loncom/homework/grades.pm:1.574.2.8
--- loncom/homework/grades.pm:1.574.2.7	Wed Jan 27 05:12:15 2010
+++ loncom/homework/grades.pm	Wed Jan 27 06:28:35 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.574.2.7 2010/01/27 05:12:15 raeburn Exp $
+# $Id: grades.pm,v 1.574.2.8 2010/01/27 06:28:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -7416,6 +7416,7 @@
         if (ref($nav_error)) {
             $$nav_error = 1;
         }
+        return;
     }
     my $map=$navmap->getResourceByUrl($sequence);
     my @resources=$navmap->retrieveResources($map,\&scantron_filter,1,0);
@@ -7579,8 +7580,15 @@
     my (%grader_partids_by_symb,%grader_randomlists_by_symb);
     &graders_resources_pass(\@resources,\%grader_partids_by_symb,
                             \%grader_randomlists_by_symb);
+    my $resource_error;
     foreach my $resource (@resources) {
-        my $ressymb = $resource->symb();
+        my $ressymb;
+        if (ref($resource)) {
+            $ressymb = $resource->symb();
+        } else {
+            $resource_error = 1;
+            last;
+        }
         my ($analysis,$parts) =
             &scantron_partids_tograde($resource,$env{'request.course.id'},
                                       $env{'user.name'},$env{'user.domain'},1);
@@ -7592,6 +7600,10 @@
             }
         }
     }
+    if ($resource_error) {
+        $r->print(&navmap_errormsg());
+        return '';
+    }
 
     my ($uname,$udom);
     my $result= <<SCANTRONFORM;
@@ -7662,9 +7674,15 @@
  	}
   	($uname,$udom)=split(/:/,$uname);
 
-        my %partids_by_symb;
+        my (%partids_by_symb,$res_error);
         foreach my $resource (@resources) {
-            my $ressymb = $resource->symb();
+            my $ressymb;
+            if (ref($resource)) {
+                $ressymb = $resource->symb();
+            } else {
+                $res_error = 1;
+                last;
+            }
             if ((exists($grader_randomlists_by_symb{$ressymb})) ||
                 (ref($grader_partids_by_symb{$ressymb}) ne 'ARRAY')) {
                 my ($analysis,$parts) =
@@ -7675,6 +7693,12 @@
             }
         }
 
+        if ($res_error) {
+            &scantron_add_delay(\@delayqueue,$line,
+                                'An error occurred while grading student '.$uname,2);
+            next;
+        }
+
 	&Apache::lonxml::clear_problem_counter();
   	&Apache::lonnet::appenv($scan_record);