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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 23 Jan 2007 22:00:18 -0000


albertel		Tue Jan 23 17:00:18 2007 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
  Log:
  - BUG5160 - if there isn't a specific answer to show pick one and show it
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.205 loncom/homework/caparesponse/caparesponse.pm:1.206
--- loncom/homework/caparesponse/caparesponse.pm:1.205	Tue Dec 19 09:53:18 2006
+++ loncom/homework/caparesponse/caparesponse.pm	Tue Jan 23 17:00:16 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.205 2006/12/19 14:53:18 www Exp $
+# $Id: caparesponse.pm,v 1.206 2007/01/23 22:00:16 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -237,6 +237,13 @@
 	$response_level) = @_;
     &add_in_tag_answer($parstack,$safeeval,$response_level);
 
+    if ($name eq '' || !ref($answer{$name})) {
+	if (ref($answer{$tag_internal_answer_name})) {
+	    $name = $tag_internal_answer_name;
+	} else {
+	    $name = (sort(keys(%answer)))[0];
+	}
+    }
     return if ($name eq '' || !ref($answer{$name}));
 
     my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,