version 1.512.2.21, 2019/11/04 20:50:57
|
version 1.512.2.23.2.1, 2020/01/15 13:57:36
|
Line 652 sub setup_rndseed {
|
Line 652 sub setup_rndseed {
|
} |
} |
if ($Apache::lonhomework::type eq 'randomizetry') { |
if ($Apache::lonhomework::type eq 'randomizetry') { |
my $partfortries = $Apache::inputtags::part; |
my $partfortries = $Apache::inputtags::part; |
|
# |
|
# Where question type is "randomizetry" for a problem containing |
|
# a single part (and unless type is explicitly set to not be |
|
# "randomizetry" for that part), the number of tries used to |
|
# determine randomization will be for that part, and randomization |
|
# from calls to &random() in a perl script block before the part tag, |
|
# will change based on the number of tries, and value of the |
|
# "randomizeontries" parameter in effect for the single part. |
|
# |
if (ref($probpartlist) eq 'ARRAY') { |
if (ref($probpartlist) eq 'ARRAY') { |
if ((@{$probpartlist} == 1) && ($probpartlist->[0] ne $Apache::inputtags::part)) { |
if ((@{$probpartlist} == 1) && ($probpartlist->[0] ne $partfortries)) { |
$partfortries = $probpartlist->[0]; |
if (&Apache::lonnet::EXT('resource.'.$probpartlist->[0].'.type') eq 'randomizetry') { |
if (&Apache::lonnet::EXT("resource.$partfortries.questiontype") eq 'randomizetry') { |
|
$partfortries = $probpartlist->[0]; |
$partfortries = $probpartlist->[0]; |
} else { |
} else { |
$partfortries = ''; |
$partfortries = ''; |
Line 1548 sub start_problem {
|
Line 1556 sub start_problem {
|
$target eq 'tex') { |
$target eq 'tex') { |
if ($env{'form.markaccess'}) { |
if ($env{'form.markaccess'}) { |
my @interval=&Apache::lonnet::EXT("resource.0.interval"); |
my @interval=&Apache::lonnet::EXT("resource.0.interval"); |
my $is_set = &Apache::lonnet::set_first_access($interval[1],$interval[0]); |
my ($timelimit) = ($interval[0] =~ /^(\d+)/); |
|
my $is_set = &Apache::lonnet::set_first_access($interval[1],$timelimit); |
unless (($is_set eq 'ok') || ($is_set eq 'already_set')) { |
unless (($is_set eq 'ok') || ($is_set eq 'already_set')) { |
$firstaccres = $is_set; |
$firstaccres = $is_set; |
} |
} |
Line 1566 sub start_problem {
|
Line 1575 sub start_problem {
|
$name); |
$name); |
} elsif (($target eq 'grade') && ($Apache::lonhomework::type eq 'randomizetry')) { |
} elsif (($target eq 'grade') && ($Apache::lonhomework::type eq 'randomizetry')) { |
my ($symb)= &Apache::lonnet::whichuser(); |
my ($symb)= &Apache::lonnet::whichuser(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
if ($symb ne '') { |
if (ref($navmap)) { |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $res = $navmap->getBySymb($symb); |
if (ref($navmap)) { |
if (ref($res)) { |
my $res = $navmap->getBySymb($symb); |
$probpartlist = $res->parts(); |
if (ref($res)) { |
|
$probpartlist = $res->parts(); |
|
} |
} |
} |
} |
} |
} |
} |
Line 1581 sub start_problem {
|
Line 1592 sub start_problem {
|
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
$target eq 'tex') { |
$target eq 'tex') { |
|
|
|
my ($symb) = &Apache::lonnet::whichuser(); |
#handle rand seed in construction space |
#handle rand seed in construction space |
|
if (($env{'request.state'} eq 'construct') || ($symb eq '')) { |
|
my $partorder=&Apache::lonnet::metadata($env{'request.uri'},'partorder'); |
|
if ($partorder ne '') { |
|
@{$probpartlist} = split(/,/,$partorder); |
|
} |
|
} |
my $rndseed=&setup_rndseed($safeeval,$target,$probpartlist); |
my $rndseed=&setup_rndseed($safeeval,$target,$probpartlist); |
if (($target eq 'grade') && &Apache::response::submitted()) { |
if (($target eq 'grade') && &Apache::response::submitted()) { |
if ($Apache::lonhomework::type eq 'randomizetry') { |
if ($Apache::lonhomework::type eq 'randomizetry') { |
Line 1596 sub start_problem {
|
Line 1614 sub start_problem {
|
} |
} |
} |
} |
} |
} |
my ($symb)=&Apache::lonnet::whichuser(); |
|
|
|
if ($env{'request.state'} ne "construct" && |
if ($env{'request.state'} ne "construct" && |
($symb eq '' || $Apache::lonhomework::type eq 'practice')) { |
($symb eq '' || $Apache::lonhomework::type eq 'practice')) { |
Line 3137 sub randomizetry_part_header {
|
Line 3154 sub randomizetry_part_header {
|
my ($header,$text); |
my ($header,$text); |
if ($reqtries eq 'none') { |
if ($reqtries eq 'none') { |
$header = &mt('No Question Variation'); |
$header = &mt('No Question Variation'); |
$text = &mt('For this question there will no new variation after a try.'); |
$text = &mt('For this question there will be no new variation after a try.'); |
} elsif ($reqtries > 1) { |
} elsif ($reqtries > 1) { |
$header = &mt('New Question Variation After Every [quant,_1,Try,Tries]',$reqtries); |
$header = &mt('New Question Variation After Every [quant,_1,Try,Tries]',$reqtries); |
if (($problemstatus eq 'no') || |
if (($problemstatus eq 'no') || |