--- loncom/homework/caparesponse/caparesponse.pm 2004/02/19 19:24:38 1.126.2.1 +++ loncom/homework/caparesponse/caparesponse.pm 2004/02/11 21:10:45 1.128 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.126.2.1 2004/02/19 19:24:38 albertel Exp $ +# $Id: caparesponse.pm,v 1.128 2004/02/11 21:10:45 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -391,14 +391,8 @@ sub get_table_sizes { if ($cell_width_real>$cell_width) {$cell_width=$cell_width_real;} } $cell_width+=8; - my $textwidth; - if ($ENV{'form.textwidth'} ne '') { - $ENV{'form.textwidth'}=~/(\d+)/; - $textwidth=$1; - } else { - $ENV{'textwidth'}=~/(\d+)/; - $textwidth=$1; - } + $ENV{'form.textwidth'}=~/(\d+)/; + my $textwidth=$1; my $bubbles_per_line=int($textwidth/$cell_width); my $number_of_tables = int($number_of_bubbles/$bubbles_per_line); my @table_range = (); @@ -459,7 +453,10 @@ sub make_numerical_bubbles { &Math::Random::random_set_seed(@oldseed); return @bubble_values; } - #FIXME what to do when not enough incorrects specified? + if (defined($$incorrect[0]) && + scalar(@$incorrect)+1 < $number_of_bubbles) { + &Apache::lonxml::warning("Not enough incorrect answers were specified in the incorrect array, ignoring the specified incorrect answers and instead generating them."); + } } my @factors = (1.13,1.17,1.25,1.33,1.45); #default values of factors my @powers = (1..$number_of_bubbles);