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

raeburn raeburn@source.lon-capa.org
Fri, 06 Mar 2009 21:14:50 -0000


raeburn		Fri Mar  6 21:14:50 2009 EDT

  Modified files:              
    /loncom/homework	grades.pm 
  Log:
  - Prevent ISE by checking that the item returned by &get_order() really is an array reference.
  - Pass $uname and $udom as args in &cleanRecord() call when viewing submission record. 
    - parts containing <randomlist></randomlist> might give %analyze missing needed key. 
      (structuretags::shuffle() can shuffle blocks differently so
      shown foils info is for different $part.$resp from one needed 
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.554 loncom/homework/grades.pm:1.555
--- loncom/homework/grades.pm:1.554	Fri Mar  6 16:13:29 2009
+++ loncom/homework/grades.pm	Fri Mar  6 21:14:50 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.554 2009/03/06 16:13:29 raeburn Exp $
+# $Id: grades.pm,v 1.555 2009/03/06 21:14:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -268,9 +268,12 @@
     sub get_radiobutton_correct_foil {
 	my ($partid,$respid,$symb,$uname,$udom)=@_;
 	my $analyze = &get_analyze($symb,$uname,$udom);
-	foreach my $foil (@{&get_order($partid,$respid,$symb,$uname,$udom)}) {
-	    if ($analyze->{"$partid.$respid.foil.value.$foil"} eq 'true') {
-		return $foil;
+        my $foils = &get_order($partid,$respid,$symb,$uname,$udom);
+        if (ref($foils) eq 'ARRAY') {
+	    foreach my $foil (@{$foils}) {
+	        if ($analyze->{"$partid.$respid.foil.value.$foil"} eq 'true') {
+		    return $foil;
+	        }
 	    }
 	}
     }
@@ -2127,7 +2130,7 @@
 			}
 			$lastsubonly.='<b>'.&mt('Submitted Answer:').' </b>'.
 			    &cleanRecord($subval,$responsetype,$symb,$partid,
-					 $respid,\%record,$order);
+					 $respid,\%record,$order,undef,$uname,$udom);
 			if ($similar) {$lastsubonly.="<br /><br />$similar\n";}
 			$lastsubonly.='</div>';
 		    }