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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 11 Oct 2005 20:02:31 -0000


albertel		Tue Oct 11 16:02:31 2005 EDT

  Modified files:              
    /loncom/homework	radiobuttonresponse.pm 
  Log:
  - if max is not specified, use all the foils
  
  
Index: loncom/homework/radiobuttonresponse.pm
diff -u loncom/homework/radiobuttonresponse.pm:1.103 loncom/homework/radiobuttonresponse.pm:1.104
--- loncom/homework/radiobuttonresponse.pm:1.103	Mon Jun 27 17:51:29 2005
+++ loncom/homework/radiobuttonresponse.pm	Tue Oct 11 16:02:31 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # mutliple choice style responses
 #
-# $Id: radiobuttonresponse.pm,v 1.103 2005/06/27 21:51:29 albertel Exp $
+# $Id: radiobuttonresponse.pm,v 1.104 2005/10/11 20:02:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -291,7 +291,7 @@
     my ($truecnt,$falsecnt) = &getfoilcounts();
     my $count=0;
     # we will add in 1 of the true statements
-    if (($falsecnt+1)>$max) { $count=$max } else { $count=$falsecnt+1; }
+    if ( $max>0 && ($falsecnt+1)>$max) { $count=$max } else { $count=$falsecnt+1; $max=$count; }
     my $answer=int(&Math::Random::random_uniform() * ($count));
     &Apache::lonxml::debug("Count is $count, $answer is $answer");
     my @names;