Diff for /loncom/homework/grades.pm between versions 1.503 and 1.507

version 1.503, 2008/02/01 22:50:43 version 1.507, 2008/02/04 23:30:05
Line 5524  sub scantron_validator_positional { Line 5524  sub scantron_validator_positional {
     # If the split only gives us one element.. the full length of the      # If the split only gives us one element.. the full length of the
     # answer string, no bubbles are filled in:      # answer string, no bubbles are filled in:
   
       if ($answers_needed eq '') {
           return;
       }
   
     if (length($array[0]) eq $$scantron_config{'Qlength'}*$answers_needed) {      if (length($array[0]) eq $$scantron_config{'Qlength'}*$answers_needed) {
         for (my $ans=0; $ans<$answers_needed; $ans++ ) {          for (my $ans=0; $ans<$answers_needed; $ans++ ) {
             $record->{"scantron.$ansnum.answer"}='';              $record->{"scantron.$ansnum.answer"}='';
Line 5950  SCANTRONFORM Line 5954  SCANTRONFORM
    '<input type="hidden" name="scantron.first_bubble_line.'.$line.'" value="'.$env{"form.scantron.first_bubble_line.$line"}.'" />'."\n";     '<input type="hidden" name="scantron.first_bubble_line.'.$line.'" value="'.$env{"form.scantron.first_bubble_line.$line"}.'" />'."\n";
        $chunk .=          $chunk .= 
            '<input type="hidden" name="scantron.sub_bubblelines.'.$line.'" value="'.$env{"form.scantron.sub_bubblelines.$line"}.'" />'."\n";             '<input type="hidden" name="scantron.sub_bubblelines.'.$line.'" value="'.$env{"form.scantron.sub_bubblelines.$line"}.'" />'."\n";
          $chunk .=
              '<input type="hidden" name="scantron.responsetype.'.$line.'" value="'.$env{"form.scantron.responsetype.$line"}.'" />'."\n";
        $result .= $chunk;         $result .= $chunk;
        $line++;         $line++;
    }     }
Line 6760  sub questions_to_line_list { Line 6766  sub questions_to_line_list {
     $first   = $first_bubble_line{$question-1} + 1;      $first   = $first_bubble_line{$question-1} + 1;
     $count   = $bubble_lines_per_response{$question-1};      $count   = $bubble_lines_per_response{$question-1};
         }          }
         my $last = $first+$count-1;          $last = $first+$count-1;
         push(@lines, ($first..$last));          push(@lines, ($first..$last));
     }      }
     return join(',', @lines);      return join(',', @lines);
Line 7260  sub scantron_validate_missingbubbles { Line 7266  sub scantron_validate_missingbubbles {
  # Probably here's where the error is...   # Probably here's where the error is...
   
  foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) {   foreach my $missing (@{$$scan_record{'scantron.missingerror'}}) {
     if ($missing > $max_bubble) { next; }              my $lastbubble;
               if ($missing =~ /^(\d+)\.(\d+)$/) {
                  my $question = $1;
                  my $subquestion = $2;
                  if (!defined($first_bubble_line{$question -1})) { next; }
                  my $first = $first_bubble_line{$question-1};
                  my @subans = split(/,/,$subdivided_bubble_lines{$question-1});
                  my $subcount = 1;
                  while ($subcount<$subquestion) {
                      $first += $subans[$subcount-1];
                      $subcount ++;
                  }
                  my $count = $subans[$subquestion-1];
                  $lastbubble = $first + $count;
               } else {
                   if (!defined($first_bubble_line{$missing - 1})) { next; }
                   $lastbubble = $first_bubble_line{$missing - 1} + $bubble_lines_per_response{$missing - 1};
               }
               if ($lastbubble > $max_bubble) { next; }
     push(@to_correct,$missing);      push(@to_correct,$missing);
  }   }
  if (@to_correct) {   if (@to_correct) {

Removed from v.1.503  
changed lines
  Added in v.1.507


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