Diff for /loncom/homework/caparesponse/caparesponse.pm between versions 1.195 and 1.196

version 1.195, 2006/11/01 23:24:52 version 1.196, 2006/11/10 17:47:41
Line 431  sub end_numericalresponse { Line 431  sub end_numericalresponse {
     }      }
  }   }
     } elsif ($target eq 'web' || $target eq 'tex') {      } elsif ($target eq 'web' || $target eq 'tex') {
    &check_for_answer_errors($parstack,$safeeval);
  my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};   my $award = $Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"};
  my $status = $Apache::inputtags::status['-1'];   my $status = $Apache::inputtags::status['-1'];
  if ($Apache::lonhomework::type eq 'exam') {   if ($Apache::lonhomework::type eq 'exam') {
Line 672  sub end_numericalresponse { Line 673  sub end_numericalresponse {
  $target eq 'tex' || $target eq 'analyze') {   $target eq 'tex' || $target eq 'analyze') {
  &Apache::lonxml::increment_counter($increment);   &Apache::lonxml::increment_counter($increment);
     }      }
     &Apache::response::end_response;      &Apache::response::end_response();
     return $result;      return $result;
 }  }
   
   sub check_for_answer_errors {
       my ($parstack,$safeeval) = @_;
       &add_in_tag_answer($parstack,$safeeval);
       my %counts;
       foreach my $name (keys(%answer)) {
    push(@{$counts{scalar(@{$answer{$name}{'answers'}})}},$name);
       }
       if (scalar(keys(%counts)) > 1) {
    my $counts = join(' ',map {
       my $count = $_;
       &mt("Answers [_1] had [_2] components.",
    '<tt>'.join(', ',@{$counts{$count}}).'</tt>',
    $count);
    } (sort(keys(%counts))));
    &Apache::lonxml::error(&mt("All answers must have the same number of components. Varying numbers of answers were seen. ").$counts);
       }
       use Data::Dumper;
       &Apache::lonxml::debug("count dump is ".&Dumper(\%counts));
       my $expected_number_of_inputs = (keys(%counts))[0];
       if ( $expected_number_of_inputs != scalar(@Apache::inputtags::inputlist)) {
    &Apache::lonxml::error(&mt("Expected [_1] input fields, but there were only [_2] seen.", 
      $expected_number_of_inputs,
      scalar(@Apache::inputtags::inputlist)));
       }
   }
   
 sub get_table_sizes {  sub get_table_sizes {
     my ($number_of_bubbles,$rbubble_values)=@_;      my ($number_of_bubbles,$rbubble_values)=@_;
     my $scale=2; #mm for one digit      my $scale=2; #mm for one digit

Removed from v.1.195  
changed lines
  Added in v.1.196


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