--- loncom/homework/functionplotresponse.pm 2010/11/13 03:22:58 1.37 +++ loncom/homework/functionplotresponse.pm 2010/11/13 22:30:28 1.38 @@ -1,7 +1,7 @@ # LearningOnline Network with CAPA # option list style responses # -# $Id: functionplotresponse.pm,v 1.37 2010/11/13 03:22:58 www Exp $ +# $Id: functionplotresponse.pm,v 1.38 2010/11/13 22:30:28 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -417,7 +417,7 @@ sub start_functionplotrule { $token,'8'). &Apache::edit::text_arg('Optional maximum length for range:','maximumlength', $token,'8').'
'. - &Apache::edit::select_arg(&mt('Relationship:'),'relationship', + &Apache::edit::select_or_text_arg(&mt('Relationship:'),'relationship', [['eq','equal'], ['ne','not equal'], ['ge','greater than or equal'], @@ -595,7 +595,11 @@ sub d2dt2_cubic_hermite { # sub array_index { my ($xmin,$xmax,$x)=@_; - return int(($x-$xmin)/($xmax-$xmin)*400.+0.5); + if ($x ne '') { + return int(($x-$xmin)/($xmax-$xmin)*400.+0.5); + } else { + return undef; + } } # @@ -886,7 +890,7 @@ sub functionplotrulecheck { # Basic sanity checks if ($li<0) { $li=0; } if ($lh>400) { $lh=400; } - if ($li>$lh) { + if (($li>$lh) || (!defined($lh))) { $lh=$li; }