[LON-CAPA-cvs] cvs: rat / lonuserstate.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 03 Mar 2006 22:32:49 -0000


albertel		Fri Mar  3 17:32:49 2006 EDT

  Modified files:              
    /rat	lonuserstate.pm 
  Log:
  - optimize the 'no conditions' case
  
  
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.106 rat/lonuserstate.pm:1.107
--- rat/lonuserstate.pm:1.106	Tue Feb 28 15:56:40 2006
+++ rat/lonuserstate.pm	Fri Mar  3 17:32:49 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construct and maintain state and binary representation of course for user
 #
-# $Id: lonuserstate.pm,v 1.106 2006/02/28 20:56:40 albertel Exp $
+# $Id: lonuserstate.pm,v 1.107 2006/03/03 22:32:49 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -368,7 +368,11 @@
 	} else {
 	    $hash{'conditions_'.$rid}=$sofar;
 	}
-	$newsofar='_'.$rid;
+
+	# if the expression is just the 0th condition keep it
+	# otherwise leave a pointer to this condition expression
+	$newsofar = ($sofar eq '0') ? $sofar : '_'.$rid;
+
 	if (defined($hash{'is_map_'.$rid})) {
 	    if (defined($hash{'map_start_'.$hash{'src_'.$rid}})) {
 		$sofar=$newsofar=