[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm /lonnet/perl lonnet.pm

www www@source.lon-capa.org
Mon, 06 Jun 2011 16:48:45 -0000


www		Mon Jun  6 16:48:45 2011 EDT

  Modified files:              
    /loncom/homework	lonhomework.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Bug #6476: storing maxtries and random seed
  
  
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.325 loncom/homework/lonhomework.pm:1.326
--- loncom/homework/lonhomework.pm:1.325	Mon Mar  7 19:42:21 2011
+++ loncom/homework/lonhomework.pm	Mon Jun  6 16:48:39 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.325 2011/03/07 19:42:21 www Exp $
+# $Id: lonhomework.pm,v 1.326 2011/06/06 16:48:39 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -434,6 +434,7 @@
 	if ( $tries eq '' ) { $tries = '0'; }
 	if ( $maxtries eq '' && 
 	     $env{'request.state'} ne 'construct') { $maxtries = '2'; } 
+	$Apache::lonhomework::results{'resource.'.$id.'.maxtries'}=$maxtries;
 	if ($maxtries && $tries >= $maxtries) { $status = 'CANNOT_ANSWER'; }
 	# if (correct and show prob status) or excused then CANNOT_ANSWER
 	if(($Apache::lonhomework::history{"resource.$id.solved"}=~/^correct/
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1108 loncom/lonnet/perl/lonnet.pm:1.1109
--- loncom/lonnet/perl/lonnet.pm:1.1108	Fri Jun  3 00:22:25 2011
+++ loncom/lonnet/perl/lonnet.pm	Mon Jun  6 16:48:44 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1108 2011/06/03 00:22:25 raeburn Exp $
+# $Id: lonnet.pm,v 1.1109 2011/06/06 16:48:44 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -9292,7 +9292,6 @@
     if (!$domain) { $domain=$wdomain; }
     if (!$username) { $username=$wusername }
     my $which=&get_rand_alg();
-
     if (defined(&getCODE())) {
 	if ($which eq '64bit5') {
 	    return &rndseed_CODE_64bit5($symb,$courseid,$domain,$username);
@@ -9329,6 +9328,7 @@
 	#&logthis("$symbseed:$nameseed;$domainseed|$courseseed;$namechck:$symbchck");
 	#&logthis("rndseed :$num:$symb");
 	if ($_64bit) { $num=(($num<<32)>>32); }
+        $Apache::lonhomework::results{'resource.0.rndseed'}=$num;
 	return $num;
     }
 }
@@ -9350,6 +9350,7 @@
 	#&logthis("$symbseed:$nameseed;$domainseed|$courseseed;$namechck:$symbchck");
 	#&logthis("rndseed :$num:$symb");
 	if ($_64bit) { $num1=(($num1<<32)>>32); $num2=(($num2<<32)>>32); }
+        $Apache::lonhomework::results{'resource.0.rndseed'}="$num1:$num2";
 	return "$num1,$num2";
     }
 }
@@ -9373,6 +9374,7 @@
 	#&logthis("$symbseed:$nameseed;$domainseed|$courseseed;$namechck:$symbchck");
 	#&logthis("rndseed :$num:$symb");
 	if ($_64bit) { $num1=(($num1<<32)>>32); $num2=(($num2<<32)>>32); }
+        $Apache::lonhomework::results{'resource.0.rndseed'}="$num1:$num2";
 	return "$num1,$num2";
     }
 }
@@ -9396,7 +9398,7 @@
 	#&logthis("$symbseed:$nameseed;$domainseed|$courseseed;$namechck:$symbchck");
 	#&logthis("rndseed :$num1:$num2:$_64bit");
 	if ($_64bit) { $num1=(($num1<<32)>>32); $num2=(($num2<<32)>>32); }
-	
+	$Apache::lonhomework::results{'resource.0.rndseed'}="$num1:$num2";
 	return "$num1:$num2";
     }
 }
@@ -9420,7 +9422,7 @@
 	#&logthis("$symbseed:$nameseed;$domainseed|$courseseed;$namechck:$symbchck");
 	#&logthis("rndseed :$num1:$num2:$_64bit");
 	if ($_64bit) { $num1=(($num1<<32)>>32); $num2=(($num2<<32)>>32); }
-	
+	$Apache::lonhomework::results{'resource.0.rndseed'}="$num1:$num2";
 	return "$num1:$num2";
     }
 }
@@ -9428,6 +9430,7 @@
 sub rndseed_64bit5 {
     my ($symb,$courseid,$domain,$username)=@_;
     my ($num1,$num2)=&digest("$symb,$courseid,$domain,$username");
+    $Apache::lonhomework::results{'resource.0.rndseed'}="$num1:$num2";
     return "$num1:$num2";
 }