[LON-CAPA-cvs] cvs: loncom /homework grades.pm
raeburn
raeburn@source.lon-capa.org
Sun, 27 Dec 2009 01:25:27 -0000
raeburn Sun Dec 27 01:25:27 2009 EDT
Modified files:
/loncom/homework grades.pm
Log:
- Sanity checking to prevent ISE.
- Confirm $resource is an object before calling symb() method.
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.585 loncom/homework/grades.pm:1.586
--- loncom/homework/grades.pm:1.585 Wed Dec 16 16:09:24 2009
+++ loncom/homework/grades.pm Sun Dec 27 01:25:26 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Grading handler
#
-# $Id: grades.pm,v 1.585 2009/12/16 16:09:24 bisitz Exp $
+# $Id: grades.pm,v 1.586 2009/12/27 01:25:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -7620,8 +7620,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);
@@ -7633,6 +7640,10 @@
}
}
}
+ if ($resource_error) {
+ $r->print(&navmap_errormsg());
+ return '';
+ }
my ($uname,$udom);
my $result= <<SCANTRONFORM;
@@ -7703,9 +7714,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) =
@@ -7716,6 +7733,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);