--- loncom/homework/grades.pm 2007/10/15 09:47:47 1.459 +++ loncom/homework/grades.pm 2007/10/17 09:40:49 1.460 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.459 2007/10/15 09:47:47 foxr Exp $ +# $Id: grades.pm,v 1.460 2007/10/17 09:40:49 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -57,9 +57,7 @@ my %first_bubble_line = (); # First bubb sub save_bubble_lines { - &Apache::lonnet::logthis("Saving bubble_lines..."); foreach my $line (keys(%bubble_lines_per_response)) { - &Apache::lonnet::logthis("Saving form.scantron.bubblelines.$line value: $bubble_lines_per_response{$line}"); $env{"form.scantron.bubblelines.$line"} = $bubble_lines_per_response{$line}; $env{"form.scantron.first_bubble_line.$line"} = $first_bubble_line{$line}; @@ -72,7 +70,6 @@ sub restore_bubble_lines { %bubble_lines_per_response = (); while ($env{"form.scantron.bubblelines.$line"}) { my $value = $env{"form.scantron.bubblelines.$line"}; - &Apache::lonnet::logthis("Restoring form.scantron.bubblelines.$line value: $value"); $bubble_lines_per_response{$line} = $value; $first_bubble_line{$line} = $env{"form.scantron.first_bubble_line.$line"}; @@ -87,8 +84,10 @@ sub restore_bubble_lines { sub get_response_bubbles { my ($parsed_line, $response) = @_; - my $bubble_line = $first_bubble_line{$response}; - my $bubble_lines= $bubble_lines_per_response{$response}; + + my $bubble_line = $first_bubble_line{$response-1} +1; + my $bubble_lines= $bubble_lines_per_response{$response-1}; + my $selected = ""; for (my $bline = 0; $bline < $bubble_lines; $bline++) { @@ -5269,7 +5268,12 @@ sub scantron_parse_scanline { || (&occurence_count($currentquest, "[A-Z]") > 1)) { push(@{$record{'scantron.doubleerror'}},$questnum); for (my $ans = 0; $ans < $answers_needed; $ans++) { - $record{"scantron.$ansnum.answer"}=''; + my $bubble = substr($currentquest, $ans, 1); + if ($bubble =~ /[A-Z]/ ) { + $record{"scantron.$ansnum.answer"} = $bubble; + } else { + $record{"scantron.$ansnum.answer"}=''; + } $ansnum++; } @@ -5304,7 +5308,12 @@ sub scantron_parse_scanline { || (&occurence_count($currentquest, '\d') > 1)) { push(@{$record{'scantron.doubleerror'}},$questnum); for (my $ans = 0; $ans < $answers_needed; $ans++) { - $record{"scantron.$ansnum.answer"}=''; + my $bubble = substr($currentquest, $ans, 1); + if ($bubble =~ /\d/) { + $record{"scantron.$ansnum.answer"} = $alphabet[$bubble]; + } else { + $record{"scantron.$ansnum.answer"}=''; + } $ansnum++; } @@ -5747,7 +5756,6 @@ SCANTRONFORM my $line = 0; while (defined($env{"form.scantron.bubblelines.$line"})) { - &Apache::lonnet::logthis("Saving chunk for $line"); my $chunk = ''."\n"; $chunk .= @@ -5813,7 +5821,6 @@ sub scantron_validate_file { } my $currentphase=$env{'form.validatepass'}; - &Apache::lonnet::logthis("Phase: $currentphase"); my $stop=0; while (!$stop && $currentphase < scalar(@validate_phases)) { @@ -6424,10 +6431,10 @@ ENDSCRIPT $r->print($message); $r->print("
Please indicate which bubble should be used for grading
"); foreach my $question (@{$arg}) { - my $selected = &get_response_bubbles($scan_record, $question); + my @select_array = split('',$selected); &scantron_bubble_selector($r,$scan_config,$question, - split('',$selected)); + @select_array); } } elsif ($error eq 'missingbubble') { $r->print("There have been no bubbles scanned for some question(s)
\n"); @@ -6468,12 +6475,13 @@ sub scantron_bubble_selector { my $scmode=$$scan_config{'Qon'}; + my $bubble_length = scalar(@selected); + if ($scmode eq 'number' || $scmode eq 'letter') { $max=10; } my $response = $quest-1; my $lines = $bubble_lines_per_response{$response}; - &Apache::lonnet::logthis("Question $quest, lines: $lines"); my $total_lines = $lines*2; my @alphabet=('A'..'Z'); @@ -6484,10 +6492,6 @@ sub scantron_bubble_selector { $r->print('