--- loncom/homework/default_homework.lcpm 2005/03/31 17:12:37 1.98 +++ loncom/homework/default_homework.lcpm 2005/06/17 20:24:56 1.100 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run() # -# $Id: default_homework.lcpm,v 1.98 2005/03/31 17:12:37 albertel Exp $ +# $Id: default_homework.lcpm,v 1.100 2005/06/17 20:24:56 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -89,11 +89,15 @@ sub caparesponse_check { } else { $message .="no ws in :$response:\n"; } - if ($type eq 'cs' || $type eq 'ci' || $type eq 'mc') { + &LONCAPA_INTERNAL_DEBUG(" type is $type "); + if ($type eq 'cs' || $type eq 'ci') { #for string answers make surec all places spaces occur, there is #really only 1 space, in both the answer and the response $answer=~s/ +/ /g; $response=~s/ +/ /g; + } elsif ($type eq 'mc') { + $answer=~s/[\s,]//g; + $response=~s/[\s,]//g; } if ($type eq 'float' && $unit=~/\$/) { if ($response!~/^\$/) { return "NO_UNIT: Missing \$ "; } @@ -518,11 +522,12 @@ sub format { #if ($options =~ /\$/) { $dollamode=1; } #if ($options =~ /,/) { $commamode=1; } if ($options =~ /\./) { $alwaysperiod=1; } + my $result; if ($fmt=~/s$/i) { $result=&format_significant_figures($value,$fmt); } else { $fmt=~s/e/E/g; - my $result=sprintf('%.'.$fmt,$value); + $result=sprintf('%.'.$fmt,$value); if ($alwaysperiod && $fmt eq '0f') { $result .='.'; } $result=~s/(E[+-]*)0/$1/; }