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

raeburn raeburn at source.lon-capa.org
Sun Feb 23 15:27:54 EST 2014


raeburn		Sun Feb 23 20:27:54 2014 EDT

  Modified files:              
    /rat	lonuserstate.pm 
  Log:
  - For folders with randomorder parameter set the order of resources needs to 
    be randomized when CC switches to student role in course.
    - Don't use $env{'request.role.adv'} here because it will be set to 
      $env{'user.adv'} -- as it does not get set in lonroles.pm based on the 
      current role until later, i.e., after the call to 
      Apache::lonuserstate::readmap().
  
  
Index: rat/lonuserstate.pm
diff -u rat/lonuserstate.pm:1.147 rat/lonuserstate.pm:1.148
--- rat/lonuserstate.pm:1.147	Fri Aug 16 01:41:05 2013
+++ rat/lonuserstate.pm	Sun Feb 23 20:27:54 2014
@@ -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.147 2013/08/16 01:41:05 raeburn Exp $
+# $Id: lonuserstate.pm,v 1.148 2014/02/23 20:27:54 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -282,12 +282,20 @@
     # Handle randomization and random selection
 
     if ($randomize) {
-	if (!$env{'request.role.adv'}) {
+        my $advanced;
+        if ($env{'request.course.id'}) {
+            $advanced = (&Apache::lonnet::allowed('adv') eq 'F');
+        } else {
+            $env{'request.course.id'} = $courseid;
+            $advanced = (&Apache::lonnet::allowed('adv') eq 'F');
+            $env{'request.course.id'} = '';
+        }
+        unless ($advanced) {
+            # Order of resources is not randomized if user has and advanced role in the course.
 	    my $seed;
 
-	    # In the advanced role, the map's random seed
-	    # parameter is used as the basis for computing the
-	    # seed ... if it has been specified:
+            # If the map's random seed parameter has been specified
+            # it is used as the basis for computing the seed ...
 
 	    if (defined($randompickseed{$parent_rid})) {
 		$seed = $randompickseed{$parent_rid};
@@ -327,7 +335,7 @@
 	    # processing the randomorder parameter if it is set, not
 	    # randompick.
 
-	    @map_ids=&Math::Random::random_permutation(@map_ids); 
+	    @map_ids=&Math::Random::random_permutation(@map_ids);
 	}
 
 




More information about the LON-CAPA-cvs mailing list