--- loncom/homework/default_homework.lcpm 2009/06/23 03:01:15 1.145 +++ loncom/homework/default_homework.lcpm 2010/01/06 16:59:30 1.147 @@ -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.145 2009/06/23 03:01:15 www Exp $ +# $Id: default_homework.lcpm,v 1.147 2010/01/06 16:59:30 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -326,10 +326,20 @@ sub caparesponse_check_list { $element =~ s/\s//g; } my $appendunit=$unit; - if (($unit=~/\%/) && ($answerunit ne '%')) { - $element=$element/100; - $appendunit=~s/\%//; - } +# Deal with percentages +# unit is unit entered by student, answerunit is unit by author +# Deprecated: divide answer by 100 if student entered percent, +# but author did not. Too much confusion +# if (($unit=~/\%/) && ($answerunit ne '%')) { +# $element=$element/100; +# $appendunit=~s/\%//; +# } +# Author entered percent, student did not + if (($unit!~/\%/) && ($answerunit=~/\%/)) { + $element=$element*100; + $appendunit='%'.$appendunit; + } +# Zero does not need a dimension if (($element==0) && ($unit!~/\w/) && ($answerunit=~/\w/)) { $appendunit=$answerunit; }