Diff for /loncom/homework/grades.pm between versions 1.481 and 1.482

version 1.481, 2007/11/06 10:12:27 version 1.482, 2007/11/06 11:21:21
Line 5149  sub scantron_fixup_scanline { Line 5149  sub scantron_fixup_scanline {
  }   }
     } elsif ($field eq 'answer') {      } elsif ($field eq 'answer') {
  &scantron_get_maxbubble(); # Need the bubble counter info.   &scantron_get_maxbubble(); # Need the bubble counter info.
  my $length=$scantron_config->{'Qlength'};   my $length =$scantron_config->{'Qlength'};
  my $off=$scantron_config->{'Qoff'};   my $off=$scantron_config->{'Qoff'};
  my $on=$scantron_config->{'Qon'};   my $on=$scantron_config->{'Qon'};
  my $answer=${off}x$length;  
         my $question_number = $args->{'question'} -1;          my $question_number = $args->{'question'} -1;
         my $first_position  = $first_bubble_line{$question_number};          my $first_position  = $first_bubble_line{$question_number};
  my $bubble_count    = $bubble_lines_per_response{$question_number};   my $bubble_count    = $bubble_lines_per_response{$question_number};
         my $bubbles_per_line= $$scantron_config{'Qlength'};          my $bubbles_per_line= $$scantron_config{'Qlength'};
    my $answer=${off}x($bubbles_per_line*$bubble_count);
         my $final_answer;          my $final_answer;
         if ($$scantron_config{'Qon'} eq 'letter'  ||          if ($$scantron_config{'Qon'} eq 'letter'  ||
     $$scantron_config{'Qon'} eq 'number') {       $$scantron_config{'Qon'} eq 'number') { 
Line 5173  sub scantron_fixup_scanline { Line 5173  sub scantron_fixup_scanline {
     my @alphabet=('A'..'Z');      my @alphabet=('A'..'Z');
     $answer=$alphabet[$bubble_number];      $answer=$alphabet[$bubble_number];
  } elsif ($on eq 'number') {   } elsif ($on eq 'number') {
     $answer=$args->{$bubble_number+1};      $answer= $bubble_number+1;
     if ($answer == 10) { $answer = '0'; }      if ($answer == 10) { $answer = '0'; }
  } else {   } else {
     substr($answer,$args->{'response'},1)=$on;      substr($answer,$bubble_number+$bubble_line*$bubbles_per_line,1)=$on;
       $final_answer = $answer;
  }   }
  &scan_data($scan_data,   &scan_data($scan_data,
    "$whichline.no_bubble.".$args->{'question'},undef,'1');     "$whichline.no_bubble.".$args->{'question'},undef,'1');
  for (my $l = 0; $l < $bubble_count; $l++) {  
     if ($l eq $bubble_line) {   # Positional notation already has the right final answer length..
  $final_answer .= $answer;  
     } else {   if (($on eq 'letter') || ($on eq 'number')) {
  $final_answer .= ' ';      for (my $l = 0; $l < $bubble_count; $l++) {
    if ($l eq $bubble_line) {
       $final_answer .= $answer;
    } else {
       $final_answer .= ' ';
    }
     }      }
  }   }
     }      }
Line 5192  sub scantron_fixup_scanline { Line 5198  sub scantron_fixup_scanline {
     #substr($line,$where-1,$length)=$answer;      #substr($line,$where-1,$length)=$answer;
     substr($line,       substr($line, 
    $scantron_config->{'Qstart'}+$first_position-1,     $scantron_config->{'Qstart'}+$first_position-1,
    $bubbles_per_line) = $final_answer;     $bubbles_per_line*$length) = $final_answer;
  }   }
     }      }
     return $line;      return $line;
Line 5440  sub scantron_parse_scanline { Line 5446  sub scantron_parse_scanline {
  if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {   if (!&scan_data($scan_data,"$whichline.no_bubble.$questnum")) {
     push(@{$record{"scantron.missingerror"}},$questnum);      push(@{$record{"scantron.missingerror"}},$questnum);
  }   }
     } elsif (scalar(@array) lt 2) {  
    #  If the bubble is not the last position, there will be
    # 2 elements.  If it is the last position, there will be 1 element.
   
       } elsif (scalar(@array) le 2) {
   
  my $location      = length($array[0]);   my $location      = length($array[0]);
  my $line_num      = $location / $$scantron_config{'Qlength'};   my $line_num      = $location / $$scantron_config{'Qlength'};

Removed from v.1.481  
changed lines
  Added in v.1.482


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