Diff for /loncom/homework/default_homework.lcpm between versions 1.155 and 1.156

version 1.155, 2011/05/22 03:04:51 version 1.156, 2011/06/07 22:07:09
Line 309  sub caparesponse_check_list { Line 309  sub caparesponse_check_list {
   
     &LONCAPA_INTERNAL_DEBUG("Initial final response :$responses->[0][-1]:");      &LONCAPA_INTERNAL_DEBUG("Initial final response :$responses->[0][-1]:");
     my $unit;      my $unit;
       my ($allowalgebra)=(&parameter_setting('allowalgebra',&currentpart())=~/^(yes|1|on)$/i);
     if ($type eq 'float' || $type eq '') {      if ($type eq 'float' || $type eq '') {
  #for numerical problems split off the unit   #for numerical problems split off the unit
 # if ( $responses->[0][-1]=~ /(.*[^\s])\s+([^\s]+)/ ) {          my $part1;
         if ( $responses->[0][-1]=~ /^([\d\.\,\s\$]*(?:(?:[xX\*]10[\^\*]*|[eE]*)[\+\-]*\d*)*(?:^|\S)\d+)([\$\s\w\^\*\/\(\)\+\-]*[^\d\.\s\,][\$\s\w\^\*\/\(\)\+\-]*)$/ ) {          my $part2;
     $responses->[0][-1]=$1;          if ($allowalgebra) {
     $unit=&capa_formula_fix($2);             ($part1,$part2)=($responses->[0][-1]=~ /^(.*[^\s])\s+([^\s]+)$/); 
           } else {
              ($part1,$part2)=($responses->[0][-1]=~ /^([\d\.\,\s\$]*(?:(?:[xX\*]10[\^\*]*|[eE]*)[\+\-]*\d*)*(?:^|\S)\d+)([\$\s\w\^\*\/\(\)\+\-]*[^\d\.\s\,][\$\s\w\^\*\/\(\)\+\-]*)$/);
           }
           if ($part1 && $part2) {
       $responses->[0][-1]=$part1;
       $unit=&capa_formula_fix($part2);
             &LONCAPA_INTERNAL_DEBUG("Found unit :$unit:");              &LONCAPA_INTERNAL_DEBUG("Found unit :$unit:");
  }   }
     }      }
Line 344  sub caparesponse_check_list { Line 351  sub caparesponse_check_list {
           if (($element==0) && ($unit!~/\w/) && ($answerunit=~/\w/)) {            if (($element==0) && ($unit!~/\w/) && ($answerunit=~/\w/)) {
              $appendunit=$answerunit;               $appendunit=$answerunit;
           }            }
   # Do the math for the student if allowed
             if ($allowalgebra) {
                $element=&cas('maxima',$element);
             }
           if ($appendunit ne '') {            if ($appendunit ne '') {
               $element .= " $appendunit";                $element .= " $appendunit";
           }              }  

Removed from v.1.155  
changed lines
  Added in v.1.156


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>