--- loncom/homework/caparesponse/caparesponse.pm 2003/10/23 07:31:52 1.117
+++ loncom/homework/caparesponse/caparesponse.pm 2003/10/24 17:41:45 1.120
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# caparesponse definition
#
-# $Id: caparesponse.pm,v 1.117 2003/10/23 07:31:52 albertel Exp $
+# $Id: caparesponse.pm,v 1.120 2003/10/24 17:41:45 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -208,6 +208,8 @@ sub end_numericalresponse {
}
}
if ($Apache::lonhomework::type eq 'exam') {
+ my $partid=$Apache::inputtags::part;
+ my $id=$Apache::inputtags::response[-1];
my $number_of_bubbles = &Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.numbubbles');
if (!$number_of_bubbles) { $number_of_bubbles=8; }
my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
@@ -219,7 +221,6 @@ sub end_numericalresponse {
$target,$answers[0],
$formats[0],\@incorrect);
my @alphabet=('A'..'Z');
- my $id=$Apache::inputtags::response[-1];
if ($target eq 'web') {
if ($$tagstack[-1] eq 'numericalresponse') {
if ($unit=~/\S/) {$result.=' (in '.$unit.')
';}
@@ -382,7 +383,7 @@ sub end_numericalresponse {
$result.=&Apache::response::answer_footer($$tagstack[-1]);
}
}
- if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
+ if ($target eq 'grade' || $target eq 'web' ||
$target eq 'tex' || $target eq 'analyze') {
&Apache::lonxml::increment_counter($increment);
}
@@ -443,7 +444,8 @@ sub format_number {
sub make_numerical_bubbles {
my ($number_of_bubbles,$target,$answer,$format,$incorrect) =@_;
my @bubble_values = ();
- &Apache::lonxml::debug("incorrect is $incorrect");
+ &Apache::lonxml::debug("answer is $answer incorrect is $incorrect");
+ my @oldseed=&Math::Random::random_get_seed();
if (defined($incorrect) && ref($incorrect)) {
&Apache::lonxml::debug("inside ".(scalar(@$incorrect)+1 gt $number_of_bubbles));
if (scalar(@$incorrect)+1 >= $number_of_bubbles) {
@@ -453,6 +455,7 @@ sub make_numerical_bubbles {
@bubble_values=@rand_inc[0..($number_of_bubbles-2)];
@bubble_values=sort {$a <=> $b} (@bubble_values,$answer);
&Apache::lonxml::debug("Answer was :$answer: returning :".$#bubble_values.": whih are :".join(':',@bubble_values));
+ &Math::Random::random_set_seed(@oldseed);
return @bubble_values;
}
#FIXME what to do when not enough incorrects specified?
@@ -470,6 +473,7 @@ sub make_numerical_bubbles {
$format,$target);
}
+ &Math::Random::random_set_seed(@oldseed);
return @bubble_values;
}