--- loncom/homework/caparesponse/caparesponse.pm 2005/06/26 22:30:05 1.171 +++ loncom/homework/caparesponse/caparesponse.pm 2005/07/11 18:35:23 1.174 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # caparesponse definition # -# $Id: caparesponse.pm,v 1.171 2005/06/26 22:30:05 albertel Exp $ +# $Id: caparesponse.pm,v 1.174 2005/07/11 18:35:23 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -353,7 +353,11 @@ sub end_numericalresponse { #} } my $response=$ans; - if ($unit) { + my $hideunit=&Apache::lonnet::EXT('resource.'.$partid.'_'. + $id.'.turnoffunit'); + if ($unit ne '' && + ! ($Apache::lonhomework::type eq 'exam' || + lc($hideunit) eq "yes") ) { my $cleanunit=$unit; $cleanunit=~s/\$\,//g; $response.=" $cleanunit"; @@ -389,11 +393,16 @@ sub end_numericalresponse { my ($ad,$msg)=&Apache::inputtags::finalizeawards($awards, $msgs); - my $msg=&mt('Computer\'s answer is incorrect ("[_1]"). It is likely that the tolerance range ("[_2]" to "[_3]") or significant figures ("[_4]" to "[_5]") needs to be adjusted',$response,$low,$high,$siglow,$sighigh); + my $error; + if ($siglow ne '' && $sighigh ne '') { + $error=&mt('Computer\'s answer is incorrect ("[_1]"). It is likely that the tolerance range ("[_2]" to "[_3]") or significant figures ("[_4]" to "[_5]") need to be adjusted.',$response,$low,$high,$siglow,$sighigh); + } else { + $error=&mt('Computer\'s answer is incorrect ("[_1]"). It is likely that the tolerance range ("[_2]" to "[_3]") needs to be adjusted.',$response,$low,$high); + } if ($ad ne 'EXACT_ANS' && $ad ne 'APPROX_ANS') { - &Apache::lonxml::error($msg); + &Apache::lonxml::error($error); } else { - &Apache::lonxml::warning($msg); + &Apache::lonxml::warning($error); } } }