Diff for /loncom/homework/caparesponse/caparesponse.pm between versions 1.117 and 1.121

version 1.117, 2003/10/23 07:31:52 version 1.121, 2003/10/24 18:08:24
Line 208  sub end_numericalresponse { Line 208  sub end_numericalresponse {
     }      }
  }   }
  if ($Apache::lonhomework::type eq 'exam') {   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');      my $number_of_bubbles = &Apache::lonnet::EXT('resource.'.$partid.'_'.$id.'.numbubbles');
     if (!$number_of_bubbles) { $number_of_bubbles=8; }      if (!$number_of_bubbles) { $number_of_bubbles=8; }
     my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,      my (@formats)=&Apache::lonxml::get_param_var('format',$parstack,
Line 219  sub end_numericalresponse { Line 221  sub end_numericalresponse {
       $target,$answers[0],        $target,$answers[0],
       $formats[0],\@incorrect);        $formats[0],\@incorrect);
     my @alphabet=('A'..'Z');      my @alphabet=('A'..'Z');
     my $id=$Apache::inputtags::response[-1];  
     if ($target eq 'web') {      if ($target eq 'web') {
  if ($$tagstack[-1] eq 'numericalresponse') {   if ($$tagstack[-1] eq 'numericalresponse') {
     if ($unit=~/\S/) {$result.=' (in '.$unit.')<br /><br />';}      if ($unit=~/\S/) {$result.=' (in '.$unit.')<br /><br />';}
Line 382  sub end_numericalresponse { Line 383  sub end_numericalresponse {
     $result.=&Apache::response::answer_footer($$tagstack[-1]);      $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 'answer' || 
  $target eq 'tex' || $target eq 'analyze') {   $target eq 'tex' || $target eq 'analyze') {
  &Apache::lonxml::increment_counter($increment);   &Apache::lonxml::increment_counter($increment);
     }      }
Line 443  sub format_number { Line 444  sub format_number {
 sub make_numerical_bubbles {  sub make_numerical_bubbles {
     my ($number_of_bubbles,$target,$answer,$format,$incorrect) =@_;      my ($number_of_bubbles,$target,$answer,$format,$incorrect) =@_;
     my @bubble_values = ();      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)) {      if (defined($incorrect) && ref($incorrect)) {
  &Apache::lonxml::debug("inside ".(scalar(@$incorrect)+1 gt $number_of_bubbles));   &Apache::lonxml::debug("inside ".(scalar(@$incorrect)+1 gt $number_of_bubbles));
  if (scalar(@$incorrect)+1 >= $number_of_bubbles) {   if (scalar(@$incorrect)+1 >= $number_of_bubbles) {
Line 453  sub make_numerical_bubbles { Line 455  sub make_numerical_bubbles {
     @bubble_values=@rand_inc[0..($number_of_bubbles-2)];      @bubble_values=@rand_inc[0..($number_of_bubbles-2)];
     @bubble_values=sort {$a <=> $b} (@bubble_values,$answer);      @bubble_values=sort {$a <=> $b} (@bubble_values,$answer);
     &Apache::lonxml::debug("Answer was :$answer: returning :".$#bubble_values.": whih are :".join(':',@bubble_values));      &Apache::lonxml::debug("Answer was :$answer: returning :".$#bubble_values.": whih are :".join(':',@bubble_values));
       &Math::Random::random_set_seed(@oldseed);
     return @bubble_values;      return @bubble_values;
  }   }
  #FIXME what to do when not enough incorrects specified?   #FIXME what to do when not enough incorrects specified?
Line 470  sub make_numerical_bubbles { Line 473  sub make_numerical_bubbles {
        $format,$target);         $format,$target);
   
     }      }
       &Math::Random::random_set_seed(@oldseed);
     return @bubble_values;      return @bubble_values;
 }  }
   

Removed from v.1.117  
changed lines
  Added in v.1.121


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>