Diff for /loncom/homework/default_homework.lcpm between versions 1.148 and 1.149

version 1.148, 2010/10/14 04:59:08 version 1.149, 2010/10/14 19:54:56
Line 320  sub caparesponse_check_list { Line 320  sub caparesponse_check_list {
     }      }
     &LONCAPA_INTERNAL_DEBUG("Final final response :$responses->[0][-1]:$unit:");      &LONCAPA_INTERNAL_DEBUG("Final final response :$responses->[0][-1]:$unit:");
     $unit=~s/\s//;      $unit=~s/\s//;
       my $error;
     foreach my $response (@$responses) {      foreach my $response (@$responses) {
        foreach my $element (@$response) {         foreach my $element (@$response) {
           if (($type eq 'float') || (($type eq '') && ($unit ne ''))) {            if (($type eq 'float') || (($type eq '') && ($unit ne ''))) {
Line 368  sub caparesponse_check_list { Line 369  sub caparesponse_check_list {
     for (my $j=0; $j<scalar(@$response); $j++) {       for (my $j=0; $j<scalar(@$response); $j++) { 
  my ($award,$msg) = &caparesponse_check($answer->[$j],   my ($award,$msg) = &caparesponse_check($answer->[$j],
        $response->[$j]);         $response->[$j]);
                   if ($type eq 'cs' || $type eq 'ci') {
                       $error = &verify_stringresponse($type,$award,$response->[$j],
                                                       $answer->[$j]);
                   }
  push(@awards,$award);   push(@awards,$award);
  push(@msgs,  $msg);   push(@msgs,  $msg);
     }      }
Line 394  sub caparesponse_check_list { Line 399  sub caparesponse_check_list {
     for (my $j=0; $j<scalar(@$response); $j++) {      for (my $j=0; $j<scalar(@$response); $j++) {
  my ($award,$msg) = &caparesponse_check($answer->[$j],   my ($award,$msg) = &caparesponse_check($answer->[$j],
        $response->[$j]);         $response->[$j]);
                           if ($type eq 'cs' || $type eq 'ci') {
                               $error = &verify_stringresponse($type,$award,$response->[$j],
                                                               $answer->[$j]);
                           }
  push(@awards,$award);   push(@awards,$award);
  push(@msgs,  $msg);   push(@msgs,  $msg);
     }      }
Line 440  sub caparesponse_check_list { Line 449  sub caparesponse_check_list {
     &LONCAPA_INTERNAL_DEBUG(" all final_awards ".join(':',@final_awards));      &LONCAPA_INTERNAL_DEBUG(" all final_awards ".join(':',@final_awards));
     my ($final_award,$final_msg) =       my ($final_award,$final_msg) = 
  &LONCAPA_INTERNAL_FINALIZEAWARDS(\@final_awards,\@final_msg,undef,1);   &LONCAPA_INTERNAL_FINALIZEAWARDS(\@final_awards,\@final_msg,undef,1);
     return ($final_award,$final_msg);      return ($final_award,$final_msg,$error);
   }
   
   sub verify_stringresponse {
       my ($type,$award,$resp,$ans) = @_;
       return if ($award eq 'EXACT_ANS');
       my $error;
       if ($resp =~ /^\s|\s$/) {
           $resp =~ s{^\s+|\s+$}{}g;
       }
       if ($ans =~ /^\s|\s$/) {
           $ans =~ s{^\s+|\s+$}{}g;
       }
       if ($type eq 'ci') {
           $resp = lc($resp);
           $ans = lc($ans);
       }
       if ($resp eq $ans) {
           if ($award eq 'INCORRECT') {
               $error = 'MISGRADED';
           }
       }
       return $error;
 }  }
   
 sub cas {  sub cas {

Removed from v.1.148  
changed lines
  Added in v.1.149


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