--- loncom/misc/refresh_courseids_db.pl 2010/08/22 21:14:54 1.8 +++ loncom/misc/refresh_courseids_db.pl 2010/12/16 17:03:48 1.9 @@ -1,7 +1,7 @@ #!/usr/bin/perl # The LearningOnline Network # -# $Id: refresh_courseids_db.pl,v 1.8 2010/08/22 21:14:54 raeburn Exp $ +# $Id: refresh_courseids_db.pl,v 1.9 2010/12/16 17:03:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,7 +61,7 @@ use LONCAPA qw(:DEFAULT :match); exit if ($Apache::lonnet::perlvar{'lonRole'} ne 'library'); -use vars qw( %checkparms %checkresponsetypes %checkcrstypes %anonsurvey ); +use vars qw( %checkparms %checkresponsetypes %checkcrstypes %anonsurvey %randomizetry ); # Make sure this process is running from user=www my $wwwid=getpwnam('www'); @@ -382,8 +382,10 @@ sub coursecontent_constraints { if (defined($navmap)) { my %anonsubmissions = &Apache::lonnet::dump('nohist_anonsurveys', $cdom,$cnum); + my %randomizetrysubm = &Apache::lonnet::dump('nohist_randomizetry', + $cdom,$cnum); my %allresponses; - my $anonsurv_subm; + my ($anonsurv_subm,$randbytry_subm); foreach my $res ($navmap->retrieveResources(undef,sub { $_[0]->is_problem() },1,0)) { my %responses = $res->responseTypes(); foreach my $key (keys(%responses)) { @@ -396,6 +398,9 @@ sub coursecontent_constraints { if (exists($anonsubmissions{$symb."\0".$part})) { $anonsurv_subm = 1; } + if (exists($randomizetrysubm{$symb."\0".$part})) { + $randbytry_subm = 1; + } } } foreach my $key (keys(%allresponses)) { @@ -406,6 +411,10 @@ sub coursecontent_constraints { ($reqdmajor,$reqdminor) = &update_reqd_loncaparev($anonsurvey{major}, $anonsurvey{minor},$reqdmajor,$reqdminor); } + if ($randbytry_subm) { + ($reqdmajor,$reqdminor) = &update_reqd_loncaparev($randomizetry{major}, + $randomizetry{minor},$reqdmajor,$reqdminor); + } } return ($reqdmajor,$reqdminor); } @@ -467,6 +476,7 @@ sub build_release_hashes { } } ($anonsurvey{major},$anonsurvey{minor}) = split(/\./,$Apache::lonnet::needsrelease{'parameter:type:anonsurvey'}); + ($randomizetry{major},$randomizetry{minor}) = split(/\./,$Apache::lonnet::needsrelease{'parameter:type:randomizetry'}); return; }