version 1.131, 2008/03/06 02:20:05
|
version 1.132, 2008/03/06 14:04:09
|
Line 311 sub caparesponse_check_list {
|
Line 311 sub caparesponse_check_list {
|
if ($type eq '' || $type eq 'float') { |
if ($type eq '' || $type eq 'float') { |
#for numerical problems split off the unit |
#for numerical problems split off the unit |
# if ( $responses->[0][-1]=~ /(.*[^\s])\s+([^\s]+)/ ) { |
# if ( $responses->[0][-1]=~ /(.*[^\s])\s+([^\s]+)/ ) { |
if ( $responses->[0][-1]=~ /^([\d\.\,\s\$]*(?:(?:[xX\*]10[\^\*]*|[eE]*)[\+\-]*\d*)*(?:^|\S)\d+)([\$\s\w\^\*\/\(\)\+\-]*[^\d\.][\$\s\w\^\*\/\(\)\+\-]*)$/ ) { |
if ( $responses->[0][-1]=~ /^([\d\.\,\s\$]*(?:(?:[xX\*]10[\^\*]*|[eE]*)[\+\-]*\d*)*(?:^|\S)\d+)([\$\s\w\^\*\/\(\)\+\-]*[^\d\.\s\,][\$\s\w\^\*\/\(\)\+\-]*)$/ ) { |
$responses->[0][-1]=$1; |
$responses->[0][-1]=$1; |
$unit=&capa_formula_fix($2); |
$unit=&capa_formula_fix($2); |
&LONCAPA_INTERNAL_DEBUG("Found unit :$unit:"); |
&LONCAPA_INTERNAL_DEBUG("Found unit :$unit:"); |
Line 322 sub caparesponse_check_list {
|
Line 322 sub caparesponse_check_list {
|
if ($unit ne '') { |
if ($unit ne '') { |
foreach my $response (@$responses) { |
foreach my $response (@$responses) { |
foreach my $element (@$response) { |
foreach my $element (@$response) { |
$element =~ s/\s//g; |
$element =~ s/\s//g; |
$element .= " $unit"; |
my $appendunit=$unit; |
|
if ($unit=~/\%/) { |
|
$element=$element/100; |
|
$appendunit=~s/\%//; |
|
} |
|
$element .= " $appendunit"; |
|
&LONCAPA_INTERNAL_DEBUG("Made response element :$element:"); |
} |
} |
} |
} |
} |
} |