--- loncom/homework/radiobuttonresponse.pm 2001/01/12 15:32:29 1.6 +++ loncom/homework/radiobuttonresponse.pm 2001/01/12 21:58:33 1.7 @@ -42,28 +42,31 @@ sub setrandomnumber { #FIXME needs to stablely do random picks sub end_foilgroup { my ($target,$token,$parstack,$parser,$safeeval,$style)=@_; - my $name; + my $result; - &setrandomnumber(); - my ($truecnt,$falsecnt,$max) = &getfoilcounts($parstack,$safeeval); - my $count=0; - # we will add in 1 of the true statements - if (($falsecnt+1)>$max) { $count=$max } else { $count=$falsecnt+1; } - my $answer = int(rand ($count)); - &Apache::lonxml::debug("Answer is $answer, $count from $max, $falsecnt"); - if ($target eq 'web') { - $result=&displayfoils($max,$answer); - } elsif ( $target eq 'grade') { - if ( defined $ENV{'form.submit'}) { - my $response = $ENV{'form.HWVAL'.$Apache::inputtags::response['-1']}; - if ( $response =~ /[^\s]/) { - my $id = $Apache::inputtags::response['-1']; - $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.submission"}=$response; - &Apache::lonxml::debug("submitted a $response
\n"); - if ($response == $answer) { - $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='EXACT_ANS'; - } else { - $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='INCORRECT'; + if ($target ne 'meta') { + my $name; + &setrandomnumber(); + my ($truecnt,$falsecnt,$max) = &getfoilcounts($parstack,$safeeval); + my $count=0; + # we will add in 1 of the true statements + if (($falsecnt+1)>$max) { $count=$max } else { $count=$falsecnt+1; } + my $answer = int(rand ($count)); + &Apache::lonxml::debug("Answer is $answer, $count from $max, $falsecnt"); + if ($target eq 'web') { + $result=&displayfoils($max,$answer); + } elsif ( $target eq 'grade') { + if ( defined $ENV{'form.submit'}) { + my $response = $ENV{'form.HWVAL'.$Apache::inputtags::response['-1']}; + if ( $response =~ /[^\s]/) { + my $id = $Apache::inputtags::response['-1']; + $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.submission"}=$response; + &Apache::lonxml::debug("submitted a $response
\n"); + if ($response == $answer) { + $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='EXACT_ANS'; + } else { + $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='INCORRECT'; + } } } }