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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 26 Jan 2005 22:43:43 -0000


albertel		Wed Jan 26 17:43:43 2005 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - BUG#3863 make it easier to use incorrect, incorrect="1,2,3,4,5,6,7,8,9" works now
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.160 loncom/homework/caparesponse/caparesponse.pm:1.161
--- loncom/homework/caparesponse/caparesponse.pm:1.160	Mon Jan 10 13:42:21 2005
+++ loncom/homework/caparesponse/caparesponse.pm	Wed Jan 26 17:43:43 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.160 2005/01/10 18:42:21 albertel Exp $
+# $Id: caparesponse.pm,v 1.161 2005/01/26 22:43:43 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -160,6 +160,7 @@
 		    my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,$safeeval);
 		    my (@answers)=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
 		    my (@incorrect)=&Apache::lonxml::get_param_var('incorrect',$parstack,$safeeval);
+		    if ($#incorrect eq 0) { @incorrect=(split(/,/,$incorrect[0])); }
 		    my ($values,$display)=&make_numerical_bubbles($number_of_bubbles,$target,$answers[0],$formats[0],\@incorrect,$safeeval);
 		    $response=$values->[$response];
 		}
@@ -238,6 +239,7 @@
 	    my $unit=&Apache::lonxml::get_param_var('unit',$parstack,
 						    $safeeval);
 	    my (@incorrect)=&Apache::lonxml::get_param_var('incorrect',$parstack,$safeeval);
+	    if ($#incorrect eq 0) { @incorrect=(split(/,/,$incorrect[0])); }
 	    my ($bubble_values,$bubble_display)=
 		&make_numerical_bubbles($number_of_bubbles,
 					$target,$answers[0],
@@ -310,6 +312,7 @@
 	    push (@{ $Apache::lonhomework::analyze{"parts"} },$part_id);
 	    $Apache::lonhomework::analyze{"$part_id.type"} = $tag;
 	    my (@incorrect)=&Apache::lonxml::get_param_var('incorrect',$parstack,$safeeval);
+	    if ($#incorrect eq 0) { @incorrect=(split(/,/,$incorrect[0])); }
 	    push (@{ $Apache::lonhomework::analyze{"$part_id.incorrect"} }, @incorrect);
 	    &Apache::response::check_if_computed($token,$parstack,
 						 $safeeval,'answer');
@@ -486,7 +489,7 @@
 	}
 	if (defined($$incorrect[0]) &&
 	    scalar(@$incorrect)+1 < $number_of_bubbles) {
-	    &Apache::lonxml::warning("Not enough incorrect answers were specified in the incorrect array, ignoring the specified incorrect answers and instead generating them.");
+	    &Apache::lonxml::warning("Not enough incorrect answers were specified in the incorrect array, ignoring the specified incorrect answers and instead generating them (".join(',',@$incorrect).").");
 	}
     }
     my @factors = (1.13,1.17,1.25,1.33,1.45); #default values of factors