--- rat/lonuserstate.pm 2002/06/26 15:44:35 1.30 +++ rat/lonuserstate.pm 2002/07/15 12:22:32 1.34 @@ -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.30 2002/06/26 15:44:35 www Exp $ +# $Id: lonuserstate.pm,v 1.34 2002/07/15 12:22:32 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -277,7 +277,7 @@ sub traceroute { $sofar=simplify($sofar); unless ($beenhere=~/\&$rid\&/) { $beenhere.=$rid.'&'; - if ($retfurl eq '') { + if (($retfurl eq '') && ($hash{'src_'.$rid})) { my ($mapid,$resid)=split(/\./,$rid); $retfurl=$hash{'src_'.$rid}.'?symb='. &Apache::lonnet::symbclean( @@ -409,6 +409,7 @@ sub accinit { # ------------------------------------- Selectively delete from randompick maps sub pickrandom { + my $randomoutentry=''; foreach my $rid (keys %randompick) { my $rndpick=$randompick{$rid}; my $mpc=$hash{'map_pc_'.$hash{'src_'.$rid}}; @@ -422,7 +423,7 @@ sub pickrandom { next if ($#currentrids<$rndpick); # -------------------------------- randomly eliminate the ones that should stay srand(&Apache::lonnet::rndseed($rid)); # use rid instead of symb - for (my $i=1;$i<=$#currentrids+1-$rndpick;$i++) { + for (my $i=1;$i<=$rndpick;$i++) { while (1) { my $randomidx=int(rand($#currentrids+1)); if ($currentrids[$randomidx]) { @@ -435,9 +436,19 @@ sub pickrandom { for (my $k=0; $k<=$#currentrids; $k++) { if ($currentrids[$k]) { $hash{'randomout_'.$currentrids[$k]}=1; + my ($mapid,$resid)=split(/\./,$currentrids[$k]); + $randomoutentry.='&'. + &Apache::lonnet::symbclean( + &Apache::lonnet::declutter($hash{'map_id_'.$mapid}). + '___'.$resid.'___'. + &Apache::lonnet::declutter($hash{'src_'.$currentrids[$k]}) + ).'&'; } } } + if ($randomoutentry) { + &Apache::lonnet::appenv('acc.randomout' => $randomoutentry); + } } # ---------------------------------------------------- Read map and all submaps