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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 03 Nov 2005 23:00:53 -0000


albertel		Thu Nov  3 18:00:53 2005 EDT

  Modified files:              
    /loncom/homework	response.pm 
  Log:
  - removing some debug crap
  - soime styl work
  - allow a pushrandomnumber to specfiy to only use the primary id number (<part> id or <dimension> i) to modify the random number generator
  
  
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.126 loncom/homework/response.pm:1.127
--- loncom/homework/response.pm:1.126	Tue Nov  1 16:33:49 2005
+++ loncom/homework/response.pm	Thu Nov  3 18:00:53 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.126 2005/11/01 21:33:49 albertel Exp $
+# $Id: response.pm,v 1.127 2005/11/03 23:00:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -94,9 +94,9 @@
 	# do nothing
     } else {
 	my @seed=&Math::Random::random_get_seed();
-	push (@randomseeds,\@seed);
+	push(@randomseeds,\@seed);
     }
-    &Apache::response::setrandomnumber();
+    &Apache::response::setrandomnumber(@_);
 }
 sub poprandomnumber {
     my $rand_alg=&Apache::lonnet::get_rand_alg();
@@ -113,6 +113,7 @@
 }
 
 sub setrandomnumber {
+    my ($ignore_id2) = @_;
     my $rndseed;
     $rndseed=&Apache::structuretags::setup_rndseed();
     if (!defined($rndseed)) { $rndseed=&Apache::lonnet::rndseed(); }
@@ -130,10 +131,9 @@
 	$shift_amt=scalar(@Apache::inputtags::responselist);
     } elsif ($Apache::lonhomework::parsing_a_task) {
 	$id1=$Apache::bridgetask::dimension;
-	if (defined($Apache::bridgetask::instance[-1])) {
+	if (!$ignore_id2 && defined($Apache::bridgetask::instance[-1])) {
 	    $id2=$Apache::bridgetask::instance[-1];
 	}
-	Apache->request->print("<p> $id1 $id2</p>");
 	$shift_amt=scalar(@Apache::bridgetask::instance);
     } 
     &Apache::lonxml::debug("id1: $id1, id2: $id2, shift_amt: $shift_amt");
@@ -152,8 +152,8 @@
 	}
     } else {
 	($rndmod,$rndmod2)=&Apache::lonnet::digest("$id1,$id2");
-	
     }
+
     if ($rndseed =~/([,:])/) {
 	my $char=$1;
 	use integer;